Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Exercise 8.5 form_tag

  • Loading branch information...
commit b366e26b1e2dba58642e2d6de7b3ac376248dc40 1 parent 86215e7
Simone Vittori authored
4  app/controllers/sessions_controller.rb
@@ -4,8 +4,8 @@ def new
4 4
   end
5 5
 
6 6
   def create
7  
-    user = User.find_by_email(params[:session][:email].downcase)
8  
-    if user && user.authenticate(params[:session][:password])
  7
+    user = User.find_by_email(params[:email].downcase)
  8
+    if user && user.authenticate(params[:password])
9 9
       sign_in user
10 10
       redirect_to user
11 11
     else
14  app/views/sessions/new.html.erb
@@ -3,15 +3,15 @@
3 3
 
4 4
 <div class="row">
5 5
   <div class="span6 offset3">
6  
-    <%= form_for(:session, url: sessions_path) do |f| %>
  6
+    <%= form_tag sessions_path do %>
7 7
 
8  
-      <%= f.label :email %>
9  
-      <%= f.text_field :email %>
  8
+      <%= label_tag :email %>
  9
+      <%= text_field_tag :email %>
10 10
 
11  
-      <%= f.label :password %>
12  
-      <%= f.password_field :password %>
13  
-
14  
-      <%= f.submit "Sign in", class: "btn btn-large btn-primary" %>
  11
+      <%= label_tag :password %>
  12
+      <%= password_field_tag :password %>
  13
+  
  14
+      <%= submit_tag "Sign in", class: "btn btn-large btn-primary" %>
15 15
     <% end %>
16 16
 
17 17
     <p>New user? <%= link_to "Sign up now!", signup_path %></p>

0 notes on commit b366e26

Please sign in to comment.
Something went wrong with that request. Please try again.