Displaying 2 results from an estimated 2 matches for "validate_length".
Did you mean:
validates_length
2006 Jan 08
22
Putting it all in one place with Schemas
I''m still relatively new to ROR, but I like what I see with the
database-neutral approach of Schemas. In the spirit of keeping it
simple and minimizing the number of files and location of information,
does ActiveState currently allow me to go ahead and place other low
level model information such as validation requirements and associations
inside the schema rather than putting it in
2006 May 23
11
putting the schema in the model files
...s_many :posts
attribute :name, :string
attribute :email, :string do |a|
a.validate_format :with => /regex/
end
end
class Post < ActiveRecord::Base
belongs_to :author # automatically adds author_id to the table
attribute :title, :string do |a|
a.validate_presence
a.validate_length :in => 3..100
end
attribute :summary, :text
attribute :content, :text
end
---------------------
[from: http://lists.rubyonrails.org/pipermail/rails/2006-January/011325.html]
Then Jon Smirl comes up with a list of what needs to be done to make
migrations play along schema''s in th...