lib/testable/region.rb
# Allows for a "has_many" method to be declared on a model, like a poage
# object to specify that the model was a certain region associated with
# it, but where that region occurs more than once.
Allows for a "has_many" method to be declared on a model, like a poage
object to specify that the model was a certain region associated with
it, but where that region occurs more than once.
Allows for a " has_many " method to be declared on a model like a poage object to specify that the model was a certain region associated with it but where that region occurs more than once .
def has_many(identifier, **context, &block)
        region_class = context[:class] || context[:region_class]
        collection_class = context[:through] || context[:collection_class]
        each = context[:each] || raise(ArgumentError, 'the "has_many" method requires an "each" param')
        within = context[:in] || context[:within]
        define_region_accessor(
          identifier,
          within: within,
          each: each,
          region_class: region_class,
          collection_class: collection_class,
          &block
        )
        define_finder_method(identifier)
      end
def has_many ( identifier , ** context , & block ) region_class = context [ :class ] || context [ :region_class ] collection_class = context [ :through ] || context [ :collection_class ] each = context [ :each ] || raise ( ArgumentError , 'the "has_many" method requires an "each" param' ) within = context [ :in ] || context [ :within ] define_region_accessor ( identifier , within : within , each : each , region_class : region_class , collection_class : collection_class , & block ) define_finder_method ( identifier ) end
Allows for a "has_many" method to be declared on a model, like a poage
object to specify that the model was a certain region associated with
it, but where that region occurs more than once.
Allows for a " has_many " method to be declared on a model like a poage object to specify that the model was a certain region associated with it but where that region occurs more than once .
identifier
<not_specific>
context
<not_specific>
block
<not_specific>