I have a flash object I wish to load and I believe the best place to store that asset is in the public directory. Suppose it’s stored in public/flash, there must be a better way to path to the swf than what I’ve done below. Note the ‘data’ element, it has a relative path.
def create_vnc_object
haml_tag :object,
:id => 'flash',
:width => '100%',
:height => '100%',
:type => 'application/x-shockwave-flash',
:data => '../../flash/flash.swf' do
haml_tag :param,
:name => 'movie',
:value => '../../flash/flash.swf'
end
end
Is there some rails variable that points to public?
Wouldn’t this work?
Alternatively you could use the
root_urlas the prefix:The latter works only if you have the
rootroute in yourroutes.rbfile. It will point to the root of your site (e.g.http://example.com/) which is basically thepublicfolder.