Class: ActiveRecord::UnionRelation::Subquery::MultiModelName
- Inherits:
-
Object
- Object
- ActiveRecord::UnionRelation::Subquery::MultiModelName
- Defined in:
- lib/active_record/union_relation.rb
Overview
A model name for a model that is using single-table inheritance. In this case we use the inheritance column as the discriminator and need to include all of the subclasses in the mappings hash.
Instance Attribute Summary collapse
-
#inheritance_column ⇒ Object
readonly
Returns the value of attribute inheritance_column.
-
#names ⇒ Object
readonly
Returns the value of attribute names.
Instance Method Summary collapse
- #each_name(&block) ⇒ Object
-
#initialize(inheritance_column, names) ⇒ MultiModelName
constructor
A new instance of MultiModelName.
- #to_sql ⇒ Object
Constructor Details
#initialize(inheritance_column, names) ⇒ MultiModelName
Returns a new instance of MultiModelName.
62 63 64 65 |
# File 'lib/active_record/union_relation.rb', line 62 def initialize(inheritance_column, names) @inheritance_column = inheritance_column @names = names end |
Instance Attribute Details
#inheritance_column ⇒ Object (readonly)
Returns the value of attribute inheritance_column.
60 61 62 |
# File 'lib/active_record/union_relation.rb', line 60 def inheritance_column @inheritance_column end |
#names ⇒ Object (readonly)
Returns the value of attribute names.
60 61 62 |
# File 'lib/active_record/union_relation.rb', line 60 def names @names end |
Instance Method Details
#each_name(&block) ⇒ Object
67 68 69 |
# File 'lib/active_record/union_relation.rb', line 67 def each_name(&block) names.each(&block) end |
#to_sql ⇒ Object
71 72 73 |
# File 'lib/active_record/union_relation.rb', line 71 def to_sql Arel.sql(inheritance_column) end |