Well, there could be several things going on. So, lets go step by step. 

1) Open an irb console (if you are using rails, type "rails console")
2) Try to create a new model and call valid? on it. What does it return?

Play around in the console so you can learn if your model is validating as 
expected (better yet, write some tests). If it's validating correctly, I 
would then move to your controller and see that the code there is behaving 
as expected. Once you do that, make sure that view is somehow displaying 
the errors. 

If you need more help with any step, please provide relevant code, so 
someone can better help you. 


On Tuesday, June 26, 2012 11:59:03 AM UTC-7, Ruby-Forum.com User wrote:
>
> Hi, 
>
> I have a form with 2 attributes/fields. As im not storing them in a 
> database,  i have used activemodel::validations for validations in my 
> model class. 
>
> In the views file i have 2 associated text fields (part of a form) with 
> a submit button. I have used validates_presence_of for the 2 attributes, 
> but i dont see an error even when i click the submit button with empty 
> fields. 
> How do i validate stuff in the form? 
>
> -- 
> 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 view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/hsVLKls-puEJ.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to