metamaps--metamaps/app/models/metacode.rb

24 lines
592 B
Ruby
Raw Normal View History

class Metacode < ActiveRecord::Base
has_many :in_metacode_sets
has_many :metacode_sets, :through => :in_metacode_sets
has_many :topics
def hasSelected(user)
return true if user.settings.metacodes.include? self.id.to_s
return false
end
def inMetacodeSet(metacode_set)
return true if self.metacode_sets.include? metacode_set
return false
end
2015-10-26 03:53:54 +00:00
#output json with asset_paths merged in
def as_json(options)
json = super(options.merge!(methods: :asset_path_icon))
2015-10-26 13:04:07 +00:00
json["icon"] = json["asset_path_icon"]
2015-10-26 03:53:54 +00:00
json.except("asset_path_icon")
end
end