Skip to content

Instantly share code, notes, and snippets.

@notblizzard
Created November 28, 2014 09:18
Show Gist options
  • Save notblizzard/c175f2406141a76dbc6d to your computer and use it in GitHub Desktop.
Save notblizzard/c175f2406141a76dbc6d to your computer and use it in GitHub Desktop.
def create
admin = Admin.find_by(user: params[:user])
if admin && admin.authenticate(params[:password]) != false
login admin
redirect_to root_path
else
redirect_to blog_index_path
end
end
<body>
<%= form_for :admin, url: login_path do |a| %>
<%= a.text_field :user %><br>
<%= a.text_field :password %><br>
<%= a.submit %>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment