Class: Kashmir::ActiveRecordRepresentation

Inherits:
Representation show all
Defined in:
lib/kashmir/plugins/active_record_representation.rb

Instance Attribute Summary

Attributes inherited from Representation

#field

Instance Method Summary collapse

Methods inherited from Representation

#initialize, #is_base?, #present_array, #present_hash, #primitive?, #read_value, #run_for, #should_cache?

Constructor Details

This class inherits a constructor from Kashmir::Representation

Instance Method Details

#present_value(value, arguments, level = 1, skip_cache = false) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/kashmir/plugins/active_record_representation.rb', line 4

def present_value(value, arguments, level=1, skip_cache=false)
  if value.is_a?(Kashmir) || value.is_a?(Kashmir::ArRelation)
    return value.represent(arguments, level, skip_cache)
  end

  if value.respond_to?(:represent)
    value.represent(arguments, level, skip_cache)
  end
end