Ruby On Rails Classroom image

Anil  Bist / 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
Anil  Bist

Skills    Ruby On Rails

Qualifications :- High School - SLV, College/University - Graphic Era Deemed Univ University,
Location :-Dehradun,Dehradun,Uttarakhand,India
Description:-

I started my Professional Journey in 2006 with one of the Web Development Company in Bangalore and my 1st framework was "Ruby on Rail" as Web development and delivered around 5+ Projects using this platform. Then came another dimension as JEE/Sturst framework, Gradually I realized that I want to build something on my own and give my passion and energy on creating something different a
Explore

 

  Students (0)