module AttrCsv::Adapters::ActiveRecord

Protected Instance Methods

attr_csv(*attributes) click to toggle source

Ensures the attribute methods for db fields have been defined before calling the original attr_encrypted method

Calls superclass method
# File lib/attr-csv/active-record.rb, line 15
def attr_csv(*attributes)
  define_attribute_methods rescue nil
  super
  attributes.reject { | attr | attr.is_a?(Hash) }.each { | attr | alias_method "#{attr}_before_type_cast", attr }

  # Register before_validate to update the csv fields
  before_validation :update_csved_attributes
end