如何在Facebook共享链接中提供当前URL

时间:2014-07-31 16:12:25

标签: ruby-on-rails facebook ruby-on-rails-4 facebook-sharer

我尝试使用以下代码在Facebook上进行分享:

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

毋庸置疑,href和uri链接不会被提供。如何将导轨术语request.original_url插入此链接?

有可能吗?

1 个答案:

答案 0 :(得分:2)

将您的代码更改为:

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