Sha256: 2a0ee268c874b779dcde312e131cc56451d1a8c53f8d9944074ac00dd628ee72

Contents?: true

Size: 430 Bytes

Versions: 3

Compression:

Stored size: 430 Bytes

Contents

require 'object_attorney/nested_uniqueness_validator'

class BulkPostsForm

  include ObjectAttorney

  accepts_nested_objects :posts

  validates_nested_uniqueness :posts, uniq_value: :title

  ##################### BODY BELLOW THIS LINE ####################

  def build_post(attributes = {}, post = nil)
    PostForm.new(attributes, post)
  end

  def existing_posts
    Post.all.map { |post| build_post({}, post) }
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
object_attorney-1.2.1 spec/support/models/bulk_posts_form.rb
object_attorney-1.1.2 spec/support/models/bulk_posts_form.rb
object_attorney-1.1.1 spec/support/models/bulk_posts_form.rb