Ruby On Rails Classroom image

Anil  Bist / Professional / Web Technology

 
To post your Question Join Classroom
 
Lesson Topics's No:-  First|1 | 2 | 3|
Lessons:- Changing the Layout Links

Unfortunately, if you actually examine the application in the browser, you’ll see that it doesn’t yet work. This is because the ‘‘remember me’’ functionality requires the user to have a remember token, but the current user doesn’t have one: We created the first user back in Section 7.4.3, long before implementing the callback that sets the remember token. To fix this, we need to save each user to invoke the before_save callback defined in Listing 8.18, which creates a remember token as a side effect:

 

Here we’veiterated over all the users in case you added morethan one while playing with the signup form. Note that we’ve passed an option to the save method; as currently written, save by itself wouldn’t work because we haven’t included the password or its confirmation. Indeed, for a real site we wouldn’t even know any of the passwords, but we would still want to be able to save the users. The solution is to pass validate: false to tell Active Record skip the validations (Rails API save).

                With that change, a signed-in user now sees the new links and dropdown menu defined by Listing 8.24, as shown in Figure 8.9.

      At this point, you should verify that you can sign in, close the browser, and then still be signed in when you visit the sample application. If you want, you can even inspect the browser cookies to see the result directly (Figure 8.10) .

 
 
 
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)