Hi, I used the following code line in a View file on machine http://xx.test.com:7777: <%= link_to "GoToAnotherHost", { :protocol => "http", :host => "app1books.test.com:7777", :controller => "admin", :action => "list" } %> However the result is: the link "GoToAnotherHost" is always pointed to http://xx.test.com:7777/admin/list rather than http://app1books.test.com:7777/admin/list. I.e., the :host doesn''t take effect at all! What''s wrong with this? Do you meet the same problem? Many Thanks! Shiwei --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
use :only_path and the procotol like "http://" (see below) not what one would expect, but its mentioned in the manual. <%= link_to "GoToAnotherHost", { :only_path => false, :protocol => "http://", :host => "app1books.test.com:7777", :controller => "admin", :action => "list" } %> On 28 Mai, 11:38, Shiwei <shiwei1.zh...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > I used the following code line in a View file on machinehttp://xx.test.com:7777: > <%= link_to "GoToAnotherHost", { :protocol => "http", :host => > "app1books.test.com:7777", :controller => "admin", :action => "list" } > %> > However the result is: the link "GoToAnotherHost" is always pointed tohttp://xx.test.com:7777/admin/listrather thanhttp://app1books.test.com:7777/admin/list. > I.e., the :host doesn''t take effect at all! > What''s wrong with this? Do you meet the same problem? > > Many Thanks! > Shiwei--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
You should be able to link_to a string rather than a hash. Since routes vary from site to site the hash would be risky in any event. Michael On May 28, 2:38 am, Shiwei <shiwei1.zh...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > I used the following code line in a View file on machinehttp://xx.test.com:7777: > <%= link_to "GoToAnotherHost", { :protocol => "http", :host => > "app1books.test.com:7777", :controller => "admin", :action => "list" } > %> > However the result is: the link "GoToAnotherHost" is always pointed tohttp://xx.test.com:7777/admin/listrather thanhttp://app1books.test.com:7777/admin/list. > I.e., the :host doesn''t take effect at all! > What''s wrong with this? Do you meet the same problem? > > Many Thanks! > Shiwei--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---