Question

I'm trying to make a Share on Facebook link with the following code:

<%= link_to 'Share on Facebook', 'https://www.facebook.com/dialog/share?
  app_id=xxxxxxxxxxxxxx&href=#{request.original_url}&redirect_uri=#{request.original_url}' %>

Needless to say the href and uri links don't get supplied. How can I insert the rails term request.original_url into this link?

Is it possible?

Was it helpful?

Solution

Change your code into :

<%= link_to 'Share on Facebook', "https://www.facebook.com/dialog/share?
  app_id=xxxxxxxxxxxxxx&href=#{request.original_url}&redirect_uri=#{request.original_url}" %>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top