Module: ActiveModel::Typograf
- Included in:
- ActiveRecord::Base
- Defined in:
- lib/active_model/typograf.rb
Defined Under Namespace
Modules: InstanceMethods
Instance Method Summary collapse
-
#typograf(*columns) ⇒ Object
Specify columns to typograf.
Instance Method Details
#typograf(column_name, options) ⇒ Object #typograf(column1, column2, ..., options) ⇒ Object #typograf(columns_with_options) ⇒ Object
Specify columns to typograf
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/active_model/typograf.rb', line 39 def typograf(*columns) unless respond_to?(:typograf_fields) cattr_accessor :typograf_fields self.typograf_fields = {} before_validation :typograf_current_fields include InstanceMethods end = columns. if columns == [] # There was an columns_with_options variant .each do |column, | typograf_fields[column.to_sym] = end else columns.each do |column| typograf_fields[column.to_sym] = end end end |