2014-02-15 16:55:01 +00:00
|
|
|
module JamRuby
|
|
|
|
|
class Like < ActiveRecord::Base
|
|
|
|
|
|
2014-02-15 23:23:00 +00:00
|
|
|
belongs_to :user, :class_name => "JamRuby::User", :foreign_key => "user_id"
|
2014-02-15 16:55:01 +00:00
|
|
|
belongs_to :likable, :polymorphic => true
|
|
|
|
|
|
2014-02-16 22:39:26 +00:00
|
|
|
def type
|
|
|
|
|
type = self.likable_type.gsub("JamRuby::", "").downcase
|
|
|
|
|
type
|
|
|
|
|
end
|
|
|
|
|
|
2014-02-15 16:55:01 +00:00
|
|
|
end
|
|
|
|
|
end
|