Define Rails Model Persistent Attributes in Model File
Posted
by Kevin Sylvestre
on Stack Overflow
See other posts from Stack Overflow
or by Kevin Sylvestre
Published on 2010-05-10T05:55:41Z
Indexed on
2010/05/10
6:04 UTC
Read the original article
Hit count: 238
ruby-on-rails
I recently played with MongoDB in Rails using Mongoid. I like the ability to define attributes for models within the model file (as opposed to in migrations):
class Person
include Mongoid::Document
field :name, :type => String
field :birthday, :type => Date
end
For projects that cannot use a schema-less database, does a similar feature exist? Any gems or plugins that generate schemas from a similar syntax would be greatly appreciated.
Thanks.
© Stack Overflow or respective owner