Hello,
My validate is not working, I don''t know why, it just stopped working?
Model:
class User < ActiveRecord::Base
validates_presence_of :nickname, :email, :password
validates_confirmation_of :password
validates_length_of :nickname, :password, :within => 5..40
validates_uniqueness_of :nickname, :email
validates_format_of :email, :with =>
/^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
end
Controller:
def signup
if request.post?
user = User.new(params[:user])
if user.save
flash[:notice] = "Signup successful"
redirect_to :action => ''login''
end
end
end
View:
<%= start_form_tag :action=> "signup" %>
<%= error_messages_for ''user'' %>
<dl>
<dt><label for="user_login">Desired
nickname:</label></dt>
<dd><%= text_field "user", "nickname", :size
=> 20 %></dd>
<dt><label
for="user_login">Email:</label></dt>
<dd><%= text_field "user", "email", :size =>
30 %></dd>
<dt><label for="user_password">Choose
password:</label></dt>
<dd><%= password_field "user", "password",
:size => 30 %></dd>
<dt><label for="user_password_confirmation">Confirm
password:</label></dt>
<dd><%= password_field "user",
"password_confirmation", :size => 30
%></dd>
<dt></dt>
<dd><input type="submit" value="Signup
»" class="primary"
/></dd>
</dl>
<%= end_form_tag %>
Can anyone see anything wrong??
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---