Class: Trello::AssociationBuilder::HasMany

Inherits:
Object
  • Object
show all
Defined in:
lib/trello/association_builder/has_many.rb

Class Method Summary collapse

Class Method Details

.build(model_klass, name, options) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/trello/association_builder/has_many.rb', line 5

def build(model_klass, name, options)
  model_klass.class_eval do
    define_method(name) do |*args|
      has_many_fetcher = AssociationFetcher::HasMany.new(self, name, options)
      filter_params = args[0] || {}
      has_many_fetcher.fetch(filter_params)
    end
  end
end