only run metacode.icon through asset_path if the path doesn't start with http

This commit is contained in:
Devin Howard 2015-10-26 12:12:07 +08:00 committed by Connor Turland
parent bdb5623a02
commit 684dcd8d33

View file

@ -21,7 +21,7 @@ class Metacode < ActiveRecord::Base
#output json with asset_paths merged in #output json with asset_paths merged in
def as_json(options) def as_json(options)
json = super(options.merge!(methods: :asset_path_icon)) json = super(options.merge!(methods: :asset_path_icon))
json["icon"] = json["asset_path_icon"] json["icon"] = json["asset_path_icon"] if json["icon"].start_with?('http')
json.except("asset_path_icon") json.except("asset_path_icon")
end end
end end