Tag: learn ruby on rails

错误的身份validation错误Rails连接到谷歌驱动器

我有一个联系人控制器,它有一种方法连接并将表单中提交的数据保存到我在谷歌驱动器上的帐户中的电子表格(app / models / contact.rb): def update_spreadsheet connection = GoogleDrive.login(ENV[“GMAIL_USERNAME”], ENV[“GMAIL_PASSWORD”]) ss = connection.spreadsheet_by_title(‘Learn-Rails02-Example’) if ss.nil? ss = connection.create_spreadsheet(‘Learn-Rails02-Example’) end 该方法调用我使用figaro设置的环境变量,这些变量保存在config / environments / development.rb中,如下所示: GMAIL_USERNAME: tgolsby@gmail.com GMAIL_PASSWORD: Paxxword (obviously this is a place holder for my actual password in the .yml file) 当我提交表单时,我收到以下错误: *GoogleDrive::AuthenticationError at /contacts Authentication failed for tgolsby: Response code 403 for […]

首次配置后启动Rails服务器时出现语法错误

我想跑 rails server 并在第一次配置后收到以下错误: => Booting WEBrick => Rails 4.2.6 application starting in development on http://localhost:3000 => Run `rails server -h` for more startup options => Ctrl-C to shutdown server Exiting (erb):32:in `’: undefined method `ENV’ for main:Object (NoMethodError) from /Users/rodpoblete/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/erb.rb:864:in `eval’ from /Users/rodpoblete/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/erb.rb:864:in `result’ from /Users/rodpoblete/.rvm/gems/ruby-2.3.0@learn-rails/gems/railties-4.2.6/lib/rails/application.rb:391:in `secrets’ from /Users/rodpoblete/Documents/Developer/RoR/workspace/learn-rails/config/environments/development.rb:33:in `block in ‘ from /Users/rodpoblete/.rvm/gems/ruby-2.3.0@learn-rails/gems/railties-4.2.6/lib/rails/railtie.rb:210:in […]