Module: ExtendedHasEnumeration::Arel::TableExtensions
- Defined in:
- lib/extended_has_enumeration/arel/table_extensions.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/extended_has_enumeration/arel/table_extensions.rb', line 4 def self.included(base) base.class_eval do alias_method_chain :columns, :has_enumeration def self.has_enumeration_mappings @has_enumeration_mappings ||= Hash.new {|h,k| h[k] = Hash.new} end end end |
Instance Method Details
#columns_with_has_enumeration ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/extended_has_enumeration/arel/table_extensions.rb', line 14 def columns_with_has_enumeration return @columns if @columns columns = columns_without_has_enumeration mappings = self.class.has_enumeration_mappings[name] if mappings mappings.each do |attr_name, mapping| attr = columns.detect {|c| c.name.to_s == attr_name.to_s} install_has_enumeration_attribute_mapping(attr, mapping) end end columns end |