Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Exercise 8.5 form_tag

  • Loading branch information...
commit b366e26b1e2dba58642e2d6de7b3ac376248dc40 1 parent 86215e7
@simonewebdesign authored
View
4 app/controllers/sessions_controller.rb
@@ -4,8 +4,8 @@ def new
end
def create
- user = User.find_by_email(params[:session][:email].downcase)
- if user && user.authenticate(params[:session][:password])
+ user = User.find_by_email(params[:email].downcase)
+ if user && user.authenticate(params[:password])
sign_in user
redirect_to user
else
View
14 app/views/sessions/new.html.erb
@@ -3,15 +3,15 @@
<div class="row">
<div class="span6 offset3">
- <%= form_for(:session, url: sessions_path) do |f| %>
+ <%= form_tag sessions_path do %>
- <%= f.label :email %>
- <%= f.text_field :email %>
+ <%= label_tag :email %>
+ <%= text_field_tag :email %>
- <%= f.label :password %>
- <%= f.password_field :password %>
-
- <%= f.submit "Sign in", class: "btn btn-large btn-primary" %>
+ <%= label_tag :password %>
+ <%= password_field_tag :password %>
+
+ <%= submit_tag "Sign in", class: "btn btn-large btn-primary" %>
<% end %>
<p>New user? <%= link_to "Sign up now!", signup_path %></p>
Please sign in to comment.
Something went wrong with that request. Please try again.