Ruby On Rails Classroom image

Neha  Jaggi / Professional / Web Technology

 
To post your Question Join Classroom
 
Lesson Topics's No:-  First|1 | 2 | 3 | 4|Last
Lessons:- Remember Me

__________________________________________________________________________________________________

 

Listing 8.17 introduces the its method, which is like it but applies the subsequent test to the given attribute rather than the subject of the test. In other words,

its ( : remember token ) { should not be blank }

 

is equivalent to

it  {  @user .remember token.should not be blank }

 

The application code introduces several new elements. First, we add a callback method to create the remember token:

before save :create remember token  

 

 

This arranges for Rails to look for a method called create_remember_token and run it before saving the user. Second, the method itself is only used internally by the User model, so there’s no need to expose it to outside users. The Ruby way to accomplish this is to use the private keyword:

 

private
      def     create remember token
        # Create the token.
end

 

 
 
 
image
Neha  Jaggi

Skills    Ruby On Rails

Qualifications :- High School - , College/University - Graphic Era Hill University, Dehradun, College/University - ,
Location :-Dehradun,Dehradun,UTTARAKHAND,India
Description:-

Experienced Software Developer with a demonstrated history of working in the Information Technology and services industry. Skilled in Web Technologies (Ruby on Rails, PostgreSQL, php, Laravel and AJAX). 


Explore
 

  Students (0)