Module: DashApi::Serializer
- Defined in:
- app/services/dash_api/serializer.rb
Class Method Summary collapse
Class Method Details
.render(current_scope, includes: nil) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'app/services/dash_api/serializer.rb', line 4 def self.render(current_scope, includes: nil) opts = { except: DashApi.exclude_attributes } if includes include_hash = {} includes.each {|table_name| include_hash.merge!({ "#{table_name}": { except: DashApi.exclude_attributes } }) } current_scope.as_json(opts.merge(include: include_hash)) else current_scope.as_json(opts) end end |