Skip to content

Commit

Permalink
Merge pull request #14 from lgn21st/master
Browse files Browse the repository at this point in the history
Fix "uninitialized constant Rails" exception when using it in Sinatra.
  • Loading branch information
Scott Ballantyne committed Jun 4, 2012
2 parents dd02d62 + 9441152 commit ed4df65
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/weibo.rb
Expand Up @@ -57,12 +57,12 @@ def rubyify_keys!


if File.exists?('config/weibo.yml')
weibo_oauth = YAML.load_file('config/weibo.yml')[Rails.env || env || 'development']
weibo_oauth = YAML.load_file('config/weibo.yml')[ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "development"]
Weibo::Config.api_key = weibo_oauth["api_key"]
Weibo::Config.api_secret = weibo_oauth["api_secret"]
else
else
puts "\n\n=========================================================\n\n" +
" You haven't made a config/weibo.yml file.\n\n You should. \n\n The weibo gem will work much better if you do\n\n" +
" You haven't made a config/weibo.yml file.\n\n You should. \n\n The weibo gem will work much better if you do\n\n" +
" Please set Weibo::Config.api_key and \n Weibo::Config.api_secret\n somewhere in your initialization process\n\n" +
"=========================================================\n\n"
end
Expand All @@ -72,4 +72,4 @@ def rubyify_keys!
require 'weibo/railtie'
end
rescue
end
end

0 comments on commit ed4df65

Please sign in to comment.