metamaps--metamaps/app/models/message.rb
2016-03-23 16:29:26 -07:00

19 lines
289 B
Ruby

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