impress/app/models/swf_asset.rb

26 lines
500 B
Ruby
Raw Normal View History

class SwfAsset < ActiveRecord::Base
set_inheritance_column 'inheritance_type'
belongs_to :zone
delegate :depth, :to => :zone
2010-05-20 16:56:08 -07:00
scope :for_json, includes(:zone)
def local_url
uri = URI.parse(url)
uri.host = RemoteImpressHost
pieces = uri.path.split('/')
uri.path = "/assets/swf/outfit/#{pieces[2]}/#{pieces[4..7].join('/')}"
uri.to_s
end
2010-05-20 16:56:08 -07:00
def as_json(options={})
{
:id => id,
:depth => depth,
:local_url => local_url
}
end
end