Suppose I wish to have the following link embedded in one of my views. <p><a href="http://www.rubyonrails.org" target="_blank">Ruby on Rails</ a></p> How can I use the ''link_to'' method to generate an external link in an .erb file? I have tried various options, but keep getting routing errors.
On Nov 12, 2009, at 10:02 AM, explainer wrote:> > Suppose I wish to have the following link embedded in one of my > views. > > <p><a href="http://www.rubyonrails.org" target="_blank">Ruby on > Rails</ > a></p> > > How can I use the ''link_to'' method to generate an external link in > an .erb file? I have tried various options, but keep getting routing > errors.<%= link_to ''Ruby on Rails'', ''http://www.rubyonrails.org'', :target => ''_blank'' %> -philip
Thanks Philip, that syntax had eluded me. So simple. On Nov 12, 10:09 am, Philip Hallstrom <phi...-LSG90OXdqQE@public.gmane.org> wrote:> On Nov 12, 2009, at 10:02 AM,explainerwrote: > > > > > Suppose I wish to have the following link embedded in one of my > > views. > > > <p><a href="http://www.rubyonrails.org" target="_blank">Ruby on > > Rails</ > > a></p> > > > How can I use the ''link_to'' method to generate an external link in > > an .erb file? I have tried various options, but keep getting routing > > errors. > > <%= link_to ''Ruby on Rails'', ''http://www.rubyonrails.org'', :target => > ''_blank'' %> > > -philip