I love this plugin (I''m able to get it working mostly) but I''m running into an issue with using it in an application with an mongrel/apache specified application level URL prefix. This is a problem for both uploading and viewing the file once it has been loaded. I was able to (manually or via 2b below) load it but then the hyperlink File Column created was still missing the prefix. It generated the following URL: http://mydomain.com/people/photo/4/picture.name.jpg instead of http://mydomain.com/PREFIX/people/photo/4/picture.name.jpg Is there an easy way to modify (a helper function? variables in environment.rb ?) code to get File Column to recognize the prefix? Is this a rail''s wide prefix that I could set? Additionally I''m wishing that there were a way to define my prefix in just one place, currently, running a rails application in a subdirectory on the server requires no less than 3 modifications (for me): 1) ProxyPass /PREFIX http://127.0.0.1:8000/PREFIX (in apache) 2) a) prefix: /PREFIX (in mongrel_cluster.yml) OR b) ActionController::AbstractRequest.relative_url_root = "/PREFIX" (in environment.rb) PLUS symbolic links in my public folder 3) all of the hard coded links in my app/views/shared/_header html file for example: <a href="/PREFIX/people">people</a> There has to be an easier, more elegant way. Anybody know of one? Thanks, Dave --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I just realized that using rails'' relative_url_root (2b below) does fix problem 3 as well... and the public folder symbolic link work around (detailed here: http://www.ralree.info/2006/6/15/successful-settings-for-apache-forwarding-to-mongrel) salvages half of file column''s functionality (namely: uploading). But my main problem of *reading* these uploaded files remains. The URL that File_Column generates still doesn''t include the proper prefix. Any ideas? Is there any easy way I can get File_Column to use ActionController::AbstractRequest.relative_url_root that I set in environement.rb? On Sep 20, 4:43 pm, dschruth <dschr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I love this plugin (I''m able to get it working mostly) but I''m running > into an issue with using it in an application with an mongrel/apache > specified application level URL prefix. This is a problem for both > uploading and viewing the file once it has been loaded. I was able to > (manually or via 2b below) load it but then the hyperlink File Column > created was still missing the prefix. It generated the following URL: > > http://mydomain.com/people/photo/4/picture.name.jpg > instead ofhttp://mydomain.com/PREFIX/people/photo/4/picture.name.jpg > > Is there an easy way to modify (a helper function? variables in > environment.rb ?) code to get File Column to recognize the prefix? Is > this a rail''s wide prefix that I could set? > > Additionally I''m wishing that there were a way to define my prefix in > just one place, currently, running a rails application in a > subdirectory on the server requires no less than 3 modifications (for > me): > > 1) > ProxyPass /PREFIX http://127.0.0.1:8000/PREFIX (in apache) > > 2) > a) > prefix: /PREFIX (in mongrel_cluster.yml) > OR > b) > ActionController::AbstractRequest.relative_url_root = "/PREFIX" (in > environment.rb) PLUS symbolic links in my public folder > > 3) > all of the hard coded links in my app/views/shared/_header html file > for example: <a href="/PREFIX/people">people</a> > > There has to be an easier, more elegant way. Anybody know of one? > > Thanks, > > Dave--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Mark Reginald James
2008-Sep-21 15:20 UTC
Re: application URL prefixes in the File Column plug-in
dschruth wrote:> But my main problem of *reading* these uploaded files remains. The > URL that File_Column generates still doesn''t include the proper > prefix. > > Any ideas? Is there any easy way I can get File_Column to use > ActionController::AbstractRequest.relative_url_root that I set in > environement.rb?Have you looked into File Column''s :base_url option? -- Rails Wheels - Find Plugins, List & Sell Plugins - http://railswheels.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ah ha, Yes, in file_column.rb -------------------------------------------------- # FileColumn''s storage location is determined in the following way. All # files are saved below the so-called "root_path" directory, which defaults to # "RAILS_ROOT/public". <snip> # You can specify a custom root_path by setting the <tt>:root_path</ tt> option. # default options. You can override these with +file_column+''s +options+ parameter DEFAULT_OPTIONS = { :root_path => File.join(RAILS_ROOT, "public"), :web_root => "rails/", #added "rails/" here ------------------------------------ Thanks alot! On Sep 21, 8:20 am, Mark Reginald James <m...-ejQy8aU/RJumpXlQD71PVDSf8X3wrgjD@public.gmane.org> wrote:> dschruth wrote: > > But my main problem of *reading* these uploaded files remains. The > > URL that File_Column generates still doesn''t include the proper > > prefix. > > > Any ideas? Is there any easy way I can get File_Column to use > > ActionController::AbstractRequest.relative_url_root that I set in > > environement.rb? > > Have you looked into File Column''s :base_url option? > > -- > Rails Wheels - Find Plugins, List & Sell Plugins -http://railswheels.com--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---