Rails not showing validation error messages -


Hi guys, I'm new to rail and just making my first registration form. I have some assumptions that I have to check the rail, but for some reason this error message does not show.

I have this on my / user / signup.html.erb

  & lt; H1 & gt; Sign up now! & Lt; / H1> & Lt;% form_for: user, @U,: url = & gt; {: Action = & gt; "Signup"}. F | & Gt%; & Lt;% = f.error_messages: header_message = & gt; "Please try again!" ,: Message => "We have your registration"% & gt; & Lt;% = f.label (: first, "first name")% & gt; & Lt;% = f.text_field (: first)%> & Lt; Br / & gt; & Lt;% = f.label (: last, "last name")%> & Lt;% = f.text_field (: last)%> & Lt; Br / & gt; & Lt;% = f.label (: Username, "Username")% & gt; & Lt;% = f.text_field (: username)% & gt; & Lt; Br / & gt; & Lt;% = f.label (: password, "password")% & gt; & Lt;% = f.password_field (: password)% & gt; & Lt; Br / & gt; & Lt;% = f.label (: password_confirmation, "Confirm Password")% & gt; & Lt;% = f.password_field (: password_confirmation)%> & Lt; Br / & gt; & Lt;% = f.label (: email, "e-mail")%> & Lt;% = f.text_field (: email)%> & Lt; Br / & gt; & Lt;% = f.label (terms_of_service, "I agree to the terms of service")%> & Lt;% = f.check_box (: terms_of_service)% & gt; & Lt; Br / & gt; & Lt;% = f.submit ("Sign Up")% & gt; & Lt;% end% & gt; I have the following on the  

model

  class users & lt; ActiveRecord :: Base validates_length_of: user name, inside => 4..15 validates_length_of: password ,: inside = & gt; 3..520 validates_presence_of: first, last ,: username ,: email, password: password_confirmation validates_uniqueness_of: username,: email validates_confirmation_of: password validates_format_of: email ,: with => / ^ ([* @ \ S ++) @ ((? ::::::::::::: - Message = & gt; "Invalid Email" validates_acceptance_of: terms_of_service ,: message = & gt; "to create an account Our Terms of Service must agree " 

Controller

  Class UserController  "Success" and render: Action => Signup & End End  

Edit: I have updated my code for some reasons. Now I can not create user. This will give me errors How does anyone go around this?

administrator

  & lt;% form_for: user, @user ,: Url = & gt; The form changes in {: Action = & gt; "Signup"}. F | & Gt%;  

This can also work

   

Then change the form accordingly:

  & lt;% = f.label (: first, "first name")% & gt; & Lt;% = f.text_field: First% & gt;  

Then add F and delete _tag on each one.

And the wrong part of it:

  & lt;% = f.error_messages: header = & gt; "Please complete all fields" ,: message = & gt; "One or more fields"%> There is a problem in this  

Not sure about: Header and: This is the work of the message in the last one, but I hope you get this idea.

Form tags have been updated, because they have a bug.


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -