I’m using Rails Recipes to create a login form but instead of username
and password, my setup is firstname, lastname, password.
I seemed to be gramatically challenged and not sure how to set up the
parameter list. Can anyone offer up a suggestion.
The book shows the method starting like:
if request.post?
user = User.find(:first, :conditions => [‘username = ?’ ,
params[:username]])
So here is my attempt but with some obvious mistakes:
def login
if request.post?
user = User.find(:first, :conditions => [‘first_name = ?’,
‘last_name = ?’, params
[:first_name],
[last_name]
Actually I should ask another question, in the recipes book the login
form is built with
start_form_tag, so:
<%= start_form_tag :action => “signin” %>
Username:
<%= text_field_tag “username” %>
Password:
<%= password_field_tag “password” %>
<%= submit_tag “Sign in” %>
<%= end_form_tag %>
I am using a regular form tag , wondering if that would make a
different how the post is handled?
Here is the way I constructed the form:
Log in to your account
First name:
<%= text_field "user", "first_name" %>