Method: Brainstem::Presenter#allowed_associations
- Defined in:
- lib/brainstem/presenter.rb
#allowed_associations(is_only_query) ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Determines which associations are valid for inclusion in the current context. Mostly just removes only-restricted associations when needed.
141 142 143 144 145 146 147 |
# File 'lib/brainstem/presenter.rb', line 141 def allowed_associations(is_only_query) ActiveSupport::HashWithIndifferentAccess.new.tap do |associations| configuration[:associations].each do |name, association| associations[name] = association unless association.[:restrict_to_only] && !is_only_query end end end |