2015-01-18 10:24:15 +01:00
|
|
|
class MultiMediaDescription < ActiveRecord::Base
|
|
|
|
|
belongs_to :item
|
|
|
|
|
belongs_to :media_type
|
2015-01-22 06:38:48 +01:00
|
|
|
|
2015-04-12 11:11:26 +02:00
|
|
|
|
|
|
|
|
def attributes
|
|
|
|
|
super.merge('resized_url' => self.resized_url)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def resized_url
|
2015-11-24 10:29:46 +01:00
|
|
|
decoration_slug = item.decoration.present? ? "/#{item.decoration}" : ""
|
|
|
|
|
url.gsub('/upload/v',"/upload/c_lpad,h_281,w_375#{decoration_slug}/v")
|
2015-04-12 11:11:26 +02:00
|
|
|
end
|
|
|
|
|
|
2015-01-18 10:24:15 +01:00
|
|
|
end
|