Created
May 20, 2011 19:54
-
-
Save joesavak/983655 to your computer and use it in GitHub Desktop.
koala.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/initializers/koala.rb | |
module Facebook | |
CONFIG = YAML.load_file(Rails.root + "config/facebook.yml")[Rails.env] | |
APP_ID = CONFIG['app_id'] | |
SECRET = CONFIG['secret_key'] | |
CALLBACK_URL = CONFIG['callback_url'] | |
end | |
Koala::Facebook::OAuth.class_eval do | |
def initialize_with_default_settings(*args) | |
case args.size | |
when 0, 1 | |
raise "application id and/or secret are not specified in the config" unless Facebook::APP_ID && Facebook::SECRET | |
initialize_without_default_settings(Facebook::APP_ID.to_s, Facebook::SECRET.to_s, Facebook::CALLBACK_URL.to_s) | |
when 2, 3 | |
initialize_without_default_settings(*args) | |
end | |
end | |
alias_method_chain :initialize, :default_settings | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment