Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
Checking mergeability… Don't worry, you can still create the pull request.
  • 1 commit
  • 3 files changed
  • 0 commit comments
  • 1 contributor
View
4 app/models/user.rb
@@ -30,7 +30,7 @@ class User < ActiveRecord::Base
validates_uniqueness_of :email, :unless => :facebook_connect_user?
validates_format_of :email, :with => Authentication.email_regex, :message => Authentication.bad_email_message, :unless => :facebook_connect_user?
- after_create :register_user_to_fb
+ #after_create :register_user_to_fb
before_save :check_profile
has_many :contents, :after_add => :trigger_story
@@ -169,7 +169,7 @@ def self.create_from_fb_connect(fb_user)
new_facebooker.fb_user_id = fb_user.uid.to_i
#We need to save without validations
new_facebooker.save(false)
- new_facebooker.register_user_to_fb
+ #new_facebooker.register_user_to_fb
end
#We are going to connect this user object with a facebook id. But only ever one account.
View
2  config/environment.rb
@@ -23,8 +23,10 @@
# Load Iframe Rewriter Middleware
require "#{RAILS_ROOT}/lib/iframe_rewriter.rb"
+require "#{RAILS_ROOT}/lib/facebook_request.rb"
Rails::Initializer.run do |config|
+ config.middleware.use Rack::FacebookRequest
config.middleware.use Newscloud::IframeRewriter
# Settings in config/environments/* take precedence over those specified here.
View
21 lib/facebook_request.rb
@@ -0,0 +1,21 @@
+# THANKS TO:: http://blog.coderubik.com/2011/03/restful-facebook-canvas-app-with-rails-and-post-for-canvas/
+# Don't forget to add 'use Rack::Facebook' in config.ru.
+module Rack
+ class FacebookRequest
+
+ def initialize(app)
+ @app = app
+ end
+
+ def call(env)
+ request = Request.new(env)
+
+ if request.POST['fb_sig_app_id']
+ env["REQUEST_METHOD"] = 'GET'
+ end
+
+ return @app.call(env)
+ end
+
+ end
+end

No commit comments for this range

Something went wrong with that request. Please try again.