I got the following example from http://guides.rubyonrails.org/getting_started.html
models / post.rb
class Post < ActiveRecord::Base validates :name, :presence => true validates :title, :presence => true, :length => { :minimum => 5 } end
but it does not work
NoMethodError in PostsController#index undefined method `validates' for #<Class:0x7f1fd7b6d750>
source share