Sha256: 560bd76b919a570716bf22ee2c407be3e0aac0ada3098a5c39e8f220547d7b62

Contents?: true

Size: 667 Bytes

Versions: 31

Compression:

Stored size: 667 Bytes

Contents

module PostForm
  
  class Base

    include ObjectAttorney

    represents :post

    delegate_properties :title, :body, to: :post

    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
  
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
object_attorney-2.2.8 spec/support/form_objects/post_form.rb
object_attorney-2.2.7 spec/support/form_objects/post_form.rb
object_attorney-2.2.6 spec/support/form_objects/post_form.rb
object_attorney-2.2.5 spec/support/form_objects/post_form.rb
object_attorney-2.2.4 spec/support/form_objects/post_form.rb
object_attorney-2.2.3 spec/support/form_objects/post_form.rb
object_attorney-2.2.2 spec/support/form_objects/post_form.rb
object_attorney-2.2.1 spec/support/form_objects/post_form.rb
object_attorney-2.1.3 spec/support/form_objects/post_form.rb
object_attorney-2.1.2 spec/support/form_objects/post_form.rb
object_attorney-2.1.1 spec/support/form_objects/post_form.rb