Access Ruby on Rails 'public' directory without relative path

Posted by huntca on Stack Overflow See other posts from Stack Overflow or by huntca
Published on 2010-06-16T18:00:03Z Indexed on 2010/06/16 18:02 UTC
Read the original article Hit count: 122

Filed under:

I have a flash object I wish to load and I belive 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?

© Stack Overflow or respective owner

Related posts about ruby-on-rails