Module: ActiveModel::Serialization
- Defined in:
- lib/vworkapp_ruby/base/base.rb
Overview
AM Monkey Patches. Yuk.
Instance Method Summary collapse
Instance Method Details
#serializable_hash(options = nil) ⇒ Object
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/vworkapp_ruby/base/base.rb', line 140 def serializable_hash( = nil) ||= {} only = Array.wrap([:only]).map(&:to_s) except = Array.wrap([:except]).map(&:to_s) # AF: Changed to write_attributes attribute_names = write_attributes.keys.sort if only.any? attribute_names &= only elsif except.any? attribute_names -= except end method_names = Array.wrap([:methods]).map { |n| n if respond_to?(n.to_s) }.compact Hash[(attribute_names + method_names).map { |n| [n, send(n)] }] end |