Method: HaveAPI::ModelAdapters::ActiveRecord::Action::InstanceMethods#ar_default_includes

Defined in:
lib/haveapi/model_adapters/active_record.rb

#ar_default_includesObject

Default includes contain all associated resources specified inaction output parameters. They are fetched from the database anyway, to return the label for even unresolved association.



87
88
89
90
91
92
93
94
95
96
97
# File 'lib/haveapi/model_adapters/active_record.rb', line 87

def ar_default_includes
  ret = []

  self.class.output.params.each do |p|
    if p.is_a?(HaveAPI::Parameters::Resource) && self.class.model.reflections[p.name.to_sym]
      ret << p.name.to_sym
    end
  end

  ret
end