The code looks right.

Make sure you don't have class Post defined somewhere else (like
post.last.rb).

Also, make sure you restart the console each time you make changes to
the Post class.

Don't do a reload on the post class from inside the console as this
doesn't work with ActiveRecord last I checked.

On Mar 16, 10:53 am, Fluffy <[email protected]> wrote:
> Hi everyone,
>
> im pretty new to ruby/rails and have an issue with the getting started
> tutorial onhttp://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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to