Skip to content

Instantly share code, notes, and snippets.

@mjfreshyfresh
Created October 26, 2009 19:13
Show Gist options
  • Save mjfreshyfresh/218937 to your computer and use it in GitHub Desktop.
Save mjfreshyfresh/218937 to your computer and use it in GitHub Desktop.
# before filter
before do
p = request.env['PATH_INFO']
@request_url = p[1..p.length] unless p.nil?
end
# app_helper
def callback_attribute
if defined?(@request_url) && !@request_url.nil?
"callbackurl='#{link_to_app(@request_url)}?_method=GET'"
end
end
# in the view
<fb:comments xid="m_story_<%= @first.id %>_comments" canpost="true" candelete="false" showform="true" numposts="5" publish_feed="false" simple="true" reverse="true" returnurl="<%= link_to_app "item/#{@first.id}" %>" <%= callback_attribute %>>
<fb:title> <%= @first.couple_name %></fb:title>
</fb:comments>
@bryfox
Copy link

bryfox commented May 27, 2010

This version supports query strings and doesn't require a before filter: http://gist.github.com/270860

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment