添加Linkedin身份验证时迁移错误

时间:2014-09-30 15:17:50

标签: ruby-on-rails

我正在尝试使用Linkedin的api在我的rails应用程序中进行身份验证。我对rails非常陌生,因此我遵循了本指南http://sourcey.com/rails-4-omniauth-using-devise-with-twitter-facebook-and-linkedin/

我试过运行rake db:migrate但是得到了这个错误。完整的痕迹如下。我还添加了environment.rb文件,因为我认为这就是问题所在,但我不确定。此外,如果有人有更好的指南使用带有rails的linkedin apis请分享!谢谢您的帮助!

耙子流产了! NameError:未定义的局部变量或方法config' for main:Object /Users/alexanderkehaya/Desktop/codea/codea_app/config/environment.rb:4:in' /Users/alexanderkehaya/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:247:in require' /Users/alexanderkehaya/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:247:in阻止在'需要' /Users/alexanderkehaya/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:232:in load_dependency' /Users/alexanderkehaya/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:247:in require' /Users/alexanderkehaya/.rvm/gems/ruby-2.1.2/gems/railties-4.1.5/lib/rails/application.rb:276:in require_environment!' /Users/alexanderkehaya/.rvm/gems/ruby-2.1.2/gems/railties-4.1.5/lib/rails/application.rb:379:in阻止在run_tasks_blocks中 /Users/alexanderkehaya/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:240:in call' /Users/alexanderkehaya/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:240:in阻止执行' /Users/alexanderkehaya/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:235:in each' /Users/alexanderkehaya/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:235:in执行' /Users/alexanderkehaya/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:179:in block in invoke_with_call_chain' /Users/alexanderkehaya/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/monitor.rb:211:in mon_synchronize' /Users/alexanderkehaya/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:172:in invoke_with_call_chain' /Users/alexanderkehaya/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:201:in阻止invoke_prerequisites' /Users/alexanderkehaya/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:199:in each' /Users/alexanderkehaya/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:199:in invoke_prerequisites' /Users/alexanderkehaya/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:178:in block in invoke_with_call_chain' /Users/alexanderkehaya/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/monitor.rb:211:in mon_synchronize' /Users/alexanderkehaya/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:172:in invoke_with_call_chain' /Users/alexanderkehaya/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:165:in调用' /Users/alexanderkehaya/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/application.rb:150:in invoke_task' /Users/alexanderkehaya/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/application.rb:106:in块(top_level中的2个级别) /Users/alexanderkehaya/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/application.rb:106:in each' /Users/alexanderkehaya/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/application.rb:106:in阻止top_level' /Users/alexanderkehaya/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/application.rb:115:in run_with_threads' /Users/alexanderkehaya/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/application.rb:100:in top_level' /Users/alexanderkehaya/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/application.rb:78:in block in run' /Users/alexanderkehaya/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/application.rb:176:in standard_exception_handling' /Users/alexanderkehaya/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/application.rb:75:in run' /Users/alexanderkehaya/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/bin/rake:33:in' /Users/alexanderkehaya/.rvm/gems/ruby-2.1.2/bin/rake:23:in load' /Users/alexanderkehaya/.rvm/gems/ruby-2.1.2/bin/rake:23:in' 任务:TOP => db:migrate =>环境

environemnt.rb文件

require File.expand_path('../application', __FILE__)

config.app_domain = 'somedoamin.com'

config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.default_url_options = { host: config.app_domain }
config.action_mailer.smtp_settings = {
  address: 'smtp.gmail.com', 
  port: '587',
  enable_starttls_auto: true,
  user_name: 'someuser',
  password: 'somepass',
  authentication: :plain,
  domain: 'somedomain.com'
 }

Rails.application.initialize!

1 个答案:

答案 0 :(得分:0)

你的environment.rb确实是个问题。其中的所有配置代码:

config.app_domain = 'somedoamin.com'

config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.default_url_options = { host: config.app_domain }
config.action_mailer.smtp_settings = {
  address: 'smtp.gmail.com', 
  port: '587',
  enable_starttls_auto: true,
  user_name: 'someuser',
  password: 'somepass',
  authentication: :plain,
  domain: 'somedomain.com'
 }

是在错误的地方。如果它的开发具体,它应该在application.rbconfig/environments/development.rb