Module: Representable::JSON

Defined in:
lib/roar_extensions/representable_json_extensions.rb

Instance Method Summary collapse

Instance Method Details

#to_hash(options = {}) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/roar_extensions/representable_json_extensions.rb', line 5

def to_hash(options = {})
  if options[:include]
    options[:include].map!(&:to_sym)
    options[:include] |= self.class.always_include_attributes.map(&:to_sym)
  end
  to_hash_without_always_include_attributes(options)
end

#to_hash_without_always_include_attributesObject



3
# File 'lib/roar_extensions/representable_json_extensions.rb', line 3

alias_method :to_hash_without_always_include_attributes, :to_hash