rails validation basics


Probably the easiest one, :length. You can give :maximum length.

[sourcecode language="rails"]
class Micropost < ActiveRecord::Base
attr_accessible :content, :user_id
validates :content, :length => { :maximum => 140 }
end
[/sourcecode]