Sha256: 2ccc127fb7a2671f83874d25ade6e78b6cda13c767f6079aa465d6d80d716f4d

Contents?: true

Size: 1.81 KB

Versions: 2

Compression:

Stored size: 1.81 KB

Contents

# Generated via
#  `rails generate common_repository_model::collection <%= class_name %>`
require 'common_repository_model/collection'
class <%= class_name %> < CommonRepositoryModel::Collection
  # Write the logic for assigning the area
  def name_of_area_to_assign
  end

  # ***************************************************************************
  # ***************************************************************************
  # NOTE: When managing associations, there is a bug in the underlying
  #   has_and_belongs_to_many. To remove an item from the association, you
  #   will presently need to operate on the child object – that is the object
  #   with the RELS-EXT entry.
  #   use `object.remove_from_containers(a_container)`
  # ***************************************************************************
  # ***************************************************************************
  #
  # EXAMPLE OF .has_members && .is_member_of
  # Creates a relationship in which the RELS-EXT entries are stored in the
  # "child" object. By using the has_members and is_member_of, the RELS-EXT
  # also has an "isMemberOf" entry. In this way, we can generically walk the
  # document tree as we know a related object exists.
  #
  # has_members :children, type: "<%= class_name %>" , property: 'is_named_member_of'
  # is_member_of :parents, type: "<%= class_name %>" , property: 'is_named_member_of'
  #
  # In this case, a Page object would have the RELS-EXT entry
  # has_members :pages, type: "Page", property: "is_page_of"
  #
  # In this case, the <%= class_name %> object would have the RELS-EXT entry
  # is_member_of :containers, type: "Container", property: "is_contained_in"
  #
  # For Examples Specs:
  # https://github.com/ndlib/common_repository_model/blob/master/spec/common_repository_model/integration_spec.rb
  #

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
common_repository_model-0.1.0 lib/generators/common_repository_model/collection/templates/collection.rb.erb
common_repository_model-0.0.9 lib/generators/common_repository_model/collection/templates/collection.rb.erb