Sha256: 05fb4b2c773a7a09fbc36dcbef67be2a24ac1132853c44b5546be89afeb0f8fa

Contents?: true

Size: 796 Bytes

Versions: 3

Compression:

Stored size: 796 Bytes

Contents

# config/initializers/koala.rb
# Monkey-patch in Facebook config so Koala knows to
# automatically use Facebook settings from here if none are given

module Facebook
  CONFIG = YAML.load(ERB.new(File.read("#{Rails.root}/config/facebook.yml")).result)[Rails.env]
  APP_ID = CONFIG['app_id']
  SECRET = CONFIG['secret_key']
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, args.first)
    when 2, 3
      initialize_without_default_settings(*args)
    end
  end

  alias_method_chain :initialize, :default_settings
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rails3-generators-1.0.0 lib/generators/koala/install/templates/config/initializers/koala.rb.tt
rails3-generators-0.17.6 lib/generators/koala/install/templates/config/initializers/koala.rb.tt
rails3-generators-0.17.5 lib/generators/koala/install/templates/config/initializers/koala.rb.tt