Skip to content

Commit

Permalink
Merge pull request #55 from vala/master
Browse files Browse the repository at this point in the history
Rails 3.1 update_page
  • Loading branch information
mmangino committed Sep 2, 2011
2 parents 919a79f + ead97c8 commit 31fac9a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/facebooker2/rails/helpers/facebook_connect.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@ module FacebookConnect
# => <fb:login-button onlogin="window.location.href = &quot;/other_page&quot;;" v="2">Login with Facebook</fb:login-button>
#
def fb_login_and_redirect(url, options = {})
js = update_page do |page|
page.redirect_to url
# Check if we got the update_page method (pre-Rails 3.1)
if respond_to? 'update_page'
js = update_page do |page|
page.redirect_to url
end
# Else use plain js
else
js = "window.location.href = '#{url}'"
end

text = options.delete(:text)

#rails 3 only escapes non-html_safe strings, so get the raw string instead of the SafeBuffer
Expand Down

0 comments on commit 31fac9a

Please sign in to comment.