Hi you all, I have this piece of code in my local application: link_to_image "category", {:action => "list_by_category"}… This worked fine because I have my WEBrick server (http://localhost:3000) and that image pointed to "/images/category.png", which was equal to "localhost:3000/images/category.png". However, I''ve just uploaded my application to a server, under a directory called "ToDo" (yes, it''s the 4daysOnRails app :D). Here the image does not work, cause is referring to "mydomain.com/images/category.png", and the image is really located at "mydomain.com/ToDo/images/category.png" (under the specific "ToDo" directory). I''ve just changed that in the uploaded app (link_to_image "/ToDo/public/images/category") but, how can I put the link so it works at both places? Thanks a lot. PT: I''ve seen the url_for stuff, but I don''t know how to use it with this... -- Posted via http://www.ruby-forum.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 -~----------~----~----~----~------~----~------~--~---
Damaris Fuentes wrote:> However, I''ve just uploaded my application to a server, under a > directory called "ToDo" (yes, it''s the 4daysOnRails app :D). > Here the image does not work, cause is referring to > "mydomain.com/images/category.png", and the image is really located at > "mydomain.com/ToDo/images/category.png" (under the specific "ToDo" > directory). > I''ve just changed that in the uploaded app (link_to_image > "/ToDo/public/images/category") but, how can I put the link so it works > at both places? > > Thanks a lot. > PT: I''ve seen the url_for stuff, but I don''t know how to use it with > this...Rails uses urls form the root of the domain frequently since the routes create what look directory and confuse browsers using relative urls looking for assets. Try to install your on a subdomain rather than just a subfolder. Also be very careful that your config/database.yml is not publically accessible or you could find your entire database hacked one day. -- Posted via http://www.ruby-forum.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 -~----------~----~----~----~------~----~------~--~---
I think whant you want to do is set the asset_host configuration parameter for production mode to "/ToDo" You might need to be wary of http://dev.rubyonrails.org/ticket/5406 Fred -- Posted via http://www.ruby-forum.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 -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> I think whant you want to do is set the asset_host configuration > parameter for production mode to "/ToDo" > You might need to be wary of http://dev.rubyonrails.org/ticket/5406 > > FredI would try to change the production.rb to set the appropiate asset, cause the server is not mine and I don''t think they give me a subdomain. However, I don''t really know how Rails set the URL''s, cause: 1: controllers and actions in the controllers are set correctly: /ToDo/items/..., not /items... 2: Style sheets are also in the public directory but Rails get them correctly (/ToDo/public/stylesheets/..., not /public/stylesheets... ) -- Posted via http://www.ruby-forum.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 -~----------~----~----~----~------~----~------~--~---
Damaris Fuentes wrote:> Frederick Cheung wrote: >> I think whant you want to do is set the asset_host configuration >> parameter for production mode to "/ToDo" >> You might need to be wary of http://dev.rubyonrails.org/ticket/5406 >>Hi you all, after changing the asset in environment/production.rb (to "config.action_controller.asset_host = "/ToDo" ") something strange (for a newbie like me) has ocurred: -- With stylesheets: Before the change, the url Rails applied to the CSS was right: ToDo/public/stylesheets/todo.css. After the change is ToDo/ToDo/public… so it does not work -- With images (which was my initial problem):…nothing has happened! The url is still /images/image.png… What can I do? :( -- Posted via http://www.ruby-forum.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 -~----------~----~----~----~------~----~------~--~---