-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
Create a DSL for building fields using blocks and instance_exec'd methods rather than passing options hashes. Include attr_accessible and validates in this DSL since these methods when sent to the class still have to operate on individual fields. Messages sent in the block would override corresponding hash keys.
class Pet
include Mongoid::Document
field :ferocious do
type Boolean
default false
end
field :name do
type String
default
attr_accessible
validates :presence => true
end
belongs_to :owner do
class_name "Person"
attr_accessible
end
end