Class: ActiveExt::DataStructures::Column
- Inherits:
-
Object
- Object
- ActiveExt::DataStructures::Column
- Defined in:
- lib/active_ext/data_structures/column.rb
Instance Attribute Summary collapse
-
#association ⇒ Object
Returns the value of attribute association.
-
#column ⇒ Object
Returns the value of attribute column.
-
#name ⇒ Object
Returns the value of attribute name.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(name, active_record_class) ⇒ Column
constructor
A new instance of Column.
- #sql_type ⇒ Object
Constructor Details
#initialize(name, active_record_class) ⇒ Column
Returns a new instance of Column.
6 7 8 9 10 11 12 13 14 |
# File 'lib/active_ext/data_structures/column.rb', line 6 def initialize(name, active_record_class) @name = name.to_sym @column = active_record_class.columns_hash[self.name.to_s] @association = active_record_class.reflect_on_association(self.name) @active_record_class = active_record_class @table = active_record_class.table_name #set default options @options = {:required => false, :readonly => false} end |
Instance Attribute Details
#association ⇒ Object
Returns the value of attribute association.
4 5 6 |
# File 'lib/active_ext/data_structures/column.rb', line 4 def association @association end |
#column ⇒ Object
Returns the value of attribute column.
4 5 6 |
# File 'lib/active_ext/data_structures/column.rb', line 4 def column @column end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/active_ext/data_structures/column.rb', line 4 def name @name end |
#options ⇒ Object
Returns the value of attribute options.
4 5 6 |
# File 'lib/active_ext/data_structures/column.rb', line 4 def @options end |
Instance Method Details
#sql_type ⇒ Object
16 17 18 |
# File 'lib/active_ext/data_structures/column.rb', line 16 def sql_type @column.type end |