Module: Historical::ActiveRecord
- Defined in:
- lib/historical/active_record.rb
Defined Under Namespace
Modules: Extensions
Class Method Summary collapse
-
.sql_to_type(type) ⇒ Object
converts database fieldtypes to Ruby types.
Instance Method Summary collapse
-
#is_historical(&block) ⇒ Object
Enables Historical in this model.
Class Method Details
.sql_to_type(type) ⇒ Object
converts database fieldtypes to Ruby types
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/historical/active_record.rb', line 4 def self.sql_to_type(type) case type.to_sym when :datetime then "Time" when :text then "String" when :decimal then "Float" when :timestamp then "Time" else type.to_s.classify end end |
Instance Method Details
#is_historical(&block) ⇒ Object
Enables Historical in this model.
137 138 139 140 141 142 143 144 145 |
# File 'lib/historical/active_record.rb', line 137 def is_historical(&block) include Historical::ActiveRecord::Extensions self.historical_installed = true self.historical_customizations ||= [] self.historical_customizations << block if block_given? Historical.historical_models << self end |