Module: Kashmir::AR::ClassMethods
- Defined in:
- lib/kashmir/plugins/ar.rb
Instance Method Summary collapse
- #activerecord_rep(field, options) ⇒ Object
- #reflection_names ⇒ Object
- #rep(field, options = {}) ⇒ Object
Instance Method Details
#activerecord_rep(field, options) ⇒ Object
43 44 45 46 |
# File 'lib/kashmir/plugins/ar.rb', line 43 def activerecord_rep(field, ) representation = ActiveRecordRepresentation.new(field, ) definitions[field] = representation end |
#reflection_names ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/kashmir/plugins/ar.rb', line 35 def reflection_names if self.respond_to?(:reflections) return reflections.keys.map(&:to_sym) end [] end |
#rep(field, options = {}) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/kashmir/plugins/ar.rb', line 27 def rep(field, ={}) if reflection_names.include?(field) return activerecord_rep(field, ) end super end |