Class: ActiveRecord::Base

Inherits:
Object
  • Object
show all
Includes:
Deprecatable
Defined in:
lib/acread/active_record_ext.rb

Constant Summary

Constants included from Deprecatable

Deprecatable::ACCESSORS

Instance Method Summary collapse

Methods included from Deprecatable

included

Instance Method Details

#columnsObject



8
9
10
# File 'lib/acread/active_record_ext.rb', line 8

def columns
  self.class.columns.reject { |c| (self.class.deprecated_attributes || []).include? c.name.to_s}
end

#serializable_hash(options = {}) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/acread/active_record_ext.rb', line 15

def serializable_hash(options = {})
  options = {} if options.nil?
  options = {
    :only => self.attributes.keys.map(&:to_sym) - (self.class.deprecated_attributes || []).map(&:to_sym)
  }.update(options)
  super_serializable_hash(options)
end

#super_serializable_hashObject

ensure the deprecated attributes will be skip when serialize the record



14
# File 'lib/acread/active_record_ext.rb', line 14

alias_method :super_serializable_hash, :serializable_hash