Module: Wco::Utils
- Included in:
- Asset, Gallery, Photo, Report, Video, WcoGame::Location, WcoGame::Marker, WcoHosting::Appliance, WcoHosting::ApplianceTmpl, WcoHosting::Environment
- Defined in:
- app/models/wco/utils.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
20 21 22 |
# File 'app/models/wco/utils.rb', line 20 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
#export ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/models/wco/utils.rb', line 4 def export out = {} %w| created_at updated_at |.map do |f| out[f] = send(f) end export_fields.map do |field| if field[-3..-1] == '_id' out[field] = send(field).to_s else out[field] = send(field) end end out[:_id] = id.to_s out.with_indifferent_access end |