metamaps--metamaps/app/models/message.rb

20 lines
289 B
Ruby
Raw Normal View History

2015-12-11 19:23:41 +00:00
class Message < ActiveRecord::Base
belongs_to :user
belongs_to :resource, polymorphic: true
def user_name
self.user.name
end
def user_image
self.user.image.url
end
def as_json(options={})
json = super(:methods =>[:user_name, :user_image])
json
end
end