2013-01-01 22:45:35 +00:00
|
|
|
class Metacode < ActiveRecord::Base
|
|
|
|
|
2014-05-17 18:57:03 +00:00
|
|
|
has_many :in_metacode_sets
|
|
|
|
has_many :metacode_sets, :through => :in_metacode_sets
|
|
|
|
has_many :topics
|
2013-01-01 22:45:35 +00:00
|
|
|
|
2013-01-26 01:49:40 +00:00
|
|
|
def hasSelected(user)
|
|
|
|
return true if user.settings.metacodes.include? self.id.to_s
|
|
|
|
return false
|
|
|
|
end
|
2014-05-17 18:57:03 +00:00
|
|
|
|
|
|
|
def inMetacodeSet(metacode_set)
|
|
|
|
return true if self.metacode_sets.include? metacode_set
|
|
|
|
return false
|
|
|
|
end
|
2013-01-26 01:49:40 +00:00
|
|
|
|
2014-07-27 19:57:35 +00:00
|
|
|
end
|