Class: RelationToJSON::BaseReflection
- Inherits:
-
Object
- Object
- RelationToJSON::BaseReflection
- Defined in:
- lib/relation_to_json/base_reflection.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#reflection ⇒ Object
readonly
Returns the value of attribute reflection.
-
#required_columns ⇒ Object
Returns the value of attribute required_columns.
Instance Method Summary collapse
- #foreign_key ⇒ Object
-
#initialize(reflection, reflection_name, reflection_columns) ⇒ BaseReflection
constructor
A new instance of BaseReflection.
- #primary_key ⇒ Object
Constructor Details
#initialize(reflection, reflection_name, reflection_columns) ⇒ BaseReflection
Returns a new instance of BaseReflection.
10 11 12 13 14 |
# File 'lib/relation_to_json/base_reflection.rb', line 10 def initialize(reflection, reflection_name, reflection_columns) @reflection = reflection @name = reflection_name @required_columns = reflection_columns end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/relation_to_json/base_reflection.rb', line 7 def name @name end |
#reflection ⇒ Object (readonly)
Returns the value of attribute reflection.
7 8 9 |
# File 'lib/relation_to_json/base_reflection.rb', line 7 def reflection @reflection end |
#required_columns ⇒ Object
Returns the value of attribute required_columns.
8 9 10 |
# File 'lib/relation_to_json/base_reflection.rb', line 8 def required_columns @required_columns end |
Instance Method Details
#foreign_key ⇒ Object
22 23 24 |
# File 'lib/relation_to_json/base_reflection.rb', line 22 def foreign_key reflection.foreign_key.to_sym end |
#primary_key ⇒ Object
18 19 20 |
# File 'lib/relation_to_json/base_reflection.rb', line 18 def primary_key reflection.active_record.primary_key.to_sym end |