[Rails] Rails getting started guide: validates not working for me?
Hi everyone,
im pretty new to ruby/rails and have an issue with the getting started
tutorial on
http://guides.rubyonrails.org/getting_started.html
The model should be extended by this:
class Post < ActiveRecord::Base
validates :name, :presence => true
validates :title, :presence => true,
:length => { :minimum => 5}
end
Now when i enter this into the console
p = Post.new(:content => "A new post")
i get this:
ArgumentError: Range unspecified. Specify the :within, .......
That is not supposed to happen. Rails is 3.0.5, ruby is 1.8.7, so i
dont see a problem there....
When i change validates to validate, it creates a record with empty
values and saves it (thought of a typo, but obviously wasnt).
Im really confused. Does anybode have an idea?
Thanks for your help,
Gerd
--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home