Ruby On Rails Classroom image

Anil  Bist / Professional / Web Technology

 
To post your Question Join Classroom
 
Lesson Topics's No:-  |1 | 2|Last
Lessons:-Signin Form

Signin Form

With our tests in place, we’re ready to start developing the signin form. Recall from Listing 7.17 that the signup form uses the form_for helper, taking as an argument the user instance variable @user:

 

<%=   form for ( @userdo  |f|   %>
.
.
.
<%  end  %>

 

The main difference between this and the signin form is that we have no Session model, hence no analogue for the @user variable. This means that, in constructing the new session form, we have to give form_for slightly more information; in particular, whereas

form for( @user )

 

allows Rails to infer that the action of the form should be to POST to the URI /users, in the case of sessions we need to indicate the name of the resource and the corresponding URI: 

form for(: session, url: sessions path)

 

(A second option is to use form_tag in place of form_for; this might be more even idiomatically correct Rails, but it has less in common with the signup form, and at this stage I want to emphasize the parallel structure. Making a working form with form_tag is left as an exercise [Section 8.5].)

         With the proper form_for in hand, it’s easy to make a signin form to match the mockup in Figure 8.1 using the signup form (Listing 7.17) as a model, as shown in Listing 8.7.

 

 
 
 
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)