Module: JSONAPI::Consumer::Resource::AssociationConcern
- Extended by:
- ActiveSupport::Concern
- Included in:
- JSONAPI::Consumer::Resource
- Defined in:
- lib/jsonapi/consumer/resource/association_concern.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#association_names ⇒ Array<Symbol>
Helper method that returns the names of defined associations.
-
#each_association(&block) ⇒ Object
:nodoc:.
Instance Method Details
#association_names ⇒ Array<Symbol>
Helper method that returns the names of defined associations.
124 125 126 |
# File 'lib/jsonapi/consumer/resource/association_concern.rb', line 124 def association_names self.class._associations.keys end |
#each_association(&block) ⇒ Object
:nodoc:
111 112 113 114 115 116 117 118 119 |
# File 'lib/jsonapi/consumer/resource/association_concern.rb', line 111 def each_association(&block) self.class._associations.dup.each do |name, | association = self.send(name) if block_given? block.call(name, association, [:options]) end end end |