Sha256: 71ee423e27787ab4194134e30ab6439a5d9c2eef7ebcbca94e8b557fdc252bd1
Contents?: true
Size: 1.59 KB
Versions: 2
Compression:
Stored size: 1.59 KB
Contents
module PostForm class Base include ObjectAttorney represents :post, properties: [:title, :body] has_many :comments validates_presence_of :title end class Explicit include ObjectAttorney represents :post has_many :comments validates_presence_of :title def body=(value) post.body = value end def body post.body end def title=(value) post.title = value end def title post.title end def build_comment(attributes = {}) post.comments.build(attributes) end def existing_comments post.comments end end class Properties1 include ObjectAttorney represents :post properties :title, :user_id end class Properties2 include ObjectAttorney represents :post, properties: [:title, :user_id] end class Getters1 include ObjectAttorney represents :post getters :title, :user_id end class Getters2 include ObjectAttorney represents :post, getters: [:title, :user_id] end class Setters1 include ObjectAttorney represents :post setters :title, :user_id end class Setters2 include ObjectAttorney represents :post, setters: [:title, :user_id] end class GrandFather include ObjectAttorney represents :post end class Father < GrandFather properties :title add_exposed_getters :email, :author attr_accessor :email, :author end class Son < Father getters :body end class GrandSon < Son setters :user_id add_exposed_getters :date attr_accessor :date end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
object_attorney-2.8.1 | spec/support/form_objects/post_form.rb |
object_attorney-2.8.0 | spec/support/form_objects/post_form.rb |