Class: MnModel::Entry

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/mn_model/entry.rb

Instance Method Summary collapse

Instance Method Details

#with_dataObject



11
12
13
14
15
16
17
18
19
# File 'lib/mn_model/entry.rb', line 11

def with_data
  with_data = {"data" => Hash.new}.merge! self.serializable_hash
  note.fields.each do |f|
    item = Item.where(entry_id: id, field_id: f.id).first
    with_data["data"].merge!(f.name => item.content) if item
  end

  return with_data
end