Model check

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> 
0
source share
1 answer

This is a version issue. Installing Rails 3 solved the problem.

0
source

All Articles