Search code examples
ruby-on-railslink-to

create link_to that forwards to a second rails application using the title


I need to create a link_to that links two rails apps.

app1 (has the link) -> app2 (forwards here)

On app2 I made sure the title shows instead of the id in the url so the forwarding works.

On app1, I have

  =link_to 'Screen an episode now', 'http://www.app2.com', :class => "screen_this_show"

I would like the link_to to take me to

http://www.app2.com/@video.title

The @video.title is accessible on app1, just wondering what the syntax would be.

also I'm using rails', "2.3.15"


Solution

  • Change to this;

    link_to 'Screen an episode now', "http://www.app2.com/#{@video.title}", :class => "screen_this_show"