Module: VirtualAttributes::Base::Casts::ClassMethods
- Defined in:
- lib/virtual-attributes/base/casts.rb
Instance Method Summary collapse
Instance Method Details
#column(name, type, options = {}) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/virtual-attributes/base/casts.rb', line 16 def column(name, type, = {}) raise ArgumentError unless type.to_sym.in? TYPES super(name, ) self.columns[name.to_sym][:type] = type.to_sym, self.columns[name.to_sym][:castor] = ActiveRecord::Type.const_get(type.to_s.classify) .new(.symbolize_keys .slice(:precision, :scale, :limit)) end |