Module: Ants::Id

Extended by:
ActiveSupport::Concern
Included in:
Admin, Redirect
Defined in:
lib/concerns/ants/id.rb

Instance Method Summary collapse

Instance Method Details

#serializable_hash(options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/concerns/ants/id.rb', line 5

def serializable_hash(options={})

  attrs = super(options)

  attrs.each_pair do |k, v|

    if k.end_with?('_id')
      attrs[k] = v.to_s
    end

    if k.end_with?('_ids')
      attrs[k] = attrs[k].collect { |id| id.to_s }
    end

  end

  return attrs
end