ruby-on-railsrubyzshlearn-ruby-on-rails

Syntaxis error when Start Rails Server after first configuration


I am trying to run

rails server

and I get the following error after the first configuration:

=> 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 `<main>': 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 <top (required)>'
    from /Users/rodpoblete/.rvm/gems/ruby-2.3.0@learn-rails/gems/railties-4.2.6/lib/rails/railtie.rb:210:in `instance_eval'
    from /Users/rodpoblete/.rvm/gems/ruby-2.3.0@learn-rails/gems/railties-4.2.6/lib/rails/railtie.rb:210:in `configure'
    from /Users/rodpoblete/Documents/Developer/RoR/workspace/learn-rails/config/environments/development.rb:1:in `<top (required)>'
    from /Users/rodpoblete/.rvm/gems/ruby-2.3.0@learn-rails/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
    from /Users/rodpoblete/.rvm/gems/ruby-2.3.0@learn-rails/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `block in require'
    from /Users/rodpoblete/.rvm/gems/ruby-2.3.0@learn-rails/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:in `load_dependency'
    from /Users/rodpoblete/.rvm/gems/ruby-2.3.0@learn-rails/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
    from /Users/rodpoblete/.rvm/gems/ruby-2.3.0@learn-rails/gems/railties-4.2.6/lib/rails/engine.rb:598:in `block (2 levels) in <class:Engine>'
    from /Users/rodpoblete/.rvm/gems/ruby-2.3.0@learn-rails/gems/railties-4.2.6/lib/rails/engine.rb:597:in `each'
    from /Users/rodpoblete/.rvm/gems/ruby-2.3.0@learn-rails/gems/railties-4.2.6/lib/rails/engine.rb:597:in `block in <class:Engine>'
    from /Users/rodpoblete/.rvm/gems/ruby-2.3.0@learn-rails/gems/railties-4.2.6/lib/rails/initializable.rb:30:in `instance_exec'
    from /Users/rodpoblete/.rvm/gems/ruby-2.3.0@learn-rails/gems/railties-4.2.6/lib/rails/initializable.rb:30:in `run'
    from /Users/rodpoblete/.rvm/gems/ruby-2.3.0@learn-rails/gems/railties-4.2.6/lib/rails/initializable.rb:55:in `block in run_initializers'
    from /Users/rodpoblete/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each'
    from /Users/rodpoblete/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
    from /Users/rodpoblete/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
    from /Users/rodpoblete/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from'
    from /Users/rodpoblete/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
    from /Users/rodpoblete/.rvm/gems/ruby-2.3.0@learn-rails/gems/railties-4.2.6/lib/rails/initializable.rb:44:in `each'
    from /Users/rodpoblete/.rvm/gems/ruby-2.3.0@learn-rails/gems/railties-4.2.6/lib/rails/initializable.rb:44:in `tsort_each_child'
    from /Users/rodpoblete/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:415:in `call'
    from /Users/rodpoblete/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:415:in `each_strongly_connected_component_from'
    from /Users/rodpoblete/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component'
    from /Users/rodpoblete/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:347:in `each'
    from /Users/rodpoblete/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:347:in `call'
    from /Users/rodpoblete/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component'
    from /Users/rodpoblete/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each'
    from /Users/rodpoblete/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each'
    from /Users/rodpoblete/.rvm/gems/ruby-2.3.0@learn-rails/gems/railties-4.2.6/lib/rails/initializable.rb:54:in `run_initializers'
    from /Users/rodpoblete/.rvm/gems/ruby-2.3.0@learn-rails/gems/railties-4.2.6/lib/rails/application.rb:352:in `initialize!'
    from /Users/rodpoblete/Documents/Developer/RoR/workspace/learn-rails/config/environment.rb:5:in `<top (required)>'
    from /Users/rodpoblete/Documents/Developer/RoR/workspace/learn-rails/config.ru:3:in `require'
    from /Users/rodpoblete/Documents/Developer/RoR/workspace/learn-rails/config.ru:3:in `block in <main>'
    from /Users/rodpoblete/.rvm/gems/ruby-2.3.0@learn-rails/gems/rack-1.6.4/lib/rack/builder.rb:55:in `instance_eval'
    from /Users/rodpoblete/.rvm/gems/ruby-2.3.0@learn-rails/gems/rack-1.6.4/lib/rack/builder.rb:55:in `initialize'
    from /Users/rodpoblete/Documents/Developer/RoR/workspace/learn-rails/config.ru:in `new'
    from /Users/rodpoblete/Documents/Developer/RoR/workspace/learn-rails/config.ru:in `<main>'
    from /Users/rodpoblete/.rvm/gems/ruby-2.3.0@learn-rails/gems/rack-1.6.4/lib/rack/builder.rb:49:in `eval'
    from /Users/rodpoblete/.rvm/gems/ruby-2.3.0@learn-rails/gems/rack-1.6.4/lib/rack/builder.rb:49:in `new_from_string'
    from /Users/rodpoblete/.rvm/gems/ruby-2.3.0@learn-rails/gems/rack-1.6.4/lib/rack/builder.rb:40:in `parse_file'
    from /Users/rodpoblete/.rvm/gems/ruby-2.3.0@learn-rails/gems/rack-1.6.4/lib/rack/server.rb:299:in `build_app_and_options_from_config'
    from /Users/rodpoblete/.rvm/gems/ruby-2.3.0@learn-rails/gems/rack-1.6.4/lib/rack/server.rb:208:in `app'
    from /Users/rodpoblete/.rvm/gems/ruby-2.3.0@learn-rails/gems/railties-4.2.6/lib/rails/commands/server.rb:61:in `app'
    from /Users/rodpoblete/.rvm/gems/ruby-2.3.0@learn-rails/gems/rack-1.6.4/lib/rack/server.rb:336:in `wrapped_app'
    from /Users/rodpoblete/.rvm/gems/ruby-2.3.0@learn-rails/gems/railties-4.2.6/lib/rails/commands/server.rb:139:in `log_to_stdout'
    from /Users/rodpoblete/.rvm/gems/ruby-2.3.0@learn-rails/gems/railties-4.2.6/lib/rails/commands/server.rb:78:in `start'
    from /Users/rodpoblete/.rvm/gems/ruby-2.3.0@learn-rails/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:80:in `block in server'
    from /Users/rodpoblete/.rvm/gems/ruby-2.3.0@learn-rails/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:75:in `tap'
    from /Users/rodpoblete/.rvm/gems/ruby-2.3.0@learn-rails/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:75:in `server'
    from /Users/rodpoblete/.rvm/gems/ruby-2.3.0@learn-rails/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
    from /Users/rodpoblete/.rvm/gems/ruby-2.3.0@learn-rails/gems/railties-4.2.6/lib/rails/commands.rb:17:in `<top (required)>'
    from /Users/rodpoblete/Documents/Developer/RoR/workspace/learn-rails/bin/rails:9:in `require'
    from /Users/rodpoblete/Documents/Developer/RoR/workspace/learn-rails/bin/rails:9:in `<top (required)>'
    from /Users/rodpoblete/.rvm/gems/ruby-2.3.0@learn-rails/gems/spring-1.7.1/lib/spring/client/rails.rb:28:in `load'
    from /Users/rodpoblete/.rvm/gems/ruby-2.3.0@learn-rails/gems/spring-1.7.1/lib/spring/client/rails.rb:28:in `call'
    from /Users/rodpoblete/.rvm/gems/ruby-2.3.0@learn-rails/gems/spring-1.7.1/lib/spring/client/command.rb:7:in `call'
    from /Users/rodpoblete/.rvm/gems/ruby-2.3.0@learn-rails/gems/spring-1.7.1/lib/spring/client.rb:30:in `run'
    from /Users/rodpoblete/.rvm/gems/ruby-2.3.0@learn-rails/gems/spring-1.7.1/bin/spring:49:in `<top (required)>'
    from /Users/rodpoblete/.rvm/gems/ruby-2.3.0@learn-rails/gems/spring-1.7.1/lib/spring/binstub.rb:11:in `load'
    from /Users/rodpoblete/.rvm/gems/ruby-2.3.0@learn-rails/gems/spring-1.7.1/lib/spring/binstub.rb:11:in `<top (required)>'
    from /Users/rodpoblete/Documents/Developer/RoR/workspace/learn-rails/bin/spring:13:in `require'
    from /Users/rodpoblete/Documents/Developer/RoR/workspace/learn-rails/bin/spring:13:in `<top (required)>'
    from bin/rails:3:in `load'
    from bin/rails:3:in `<main>'

I should mention that I 'm following the book Learn Ruby on Rails: Book Two by Daniel Kehoe, I use ZSH I'm working on OSX Captain.

I would greatly appreciate your help. I'm working on a new project on rails and am newbie in this environment

that in my Gemfile

source 'https://rubygems.org'

ruby '2.3.0'
gem 'rails', '4.2.6'
# Rails Default
gem 'sqlite3'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'byebug'
gem 'web-console', '~> 2.0'
gem 'spring'

#learn-rails
gem 'foundation-rails', '~> 5.5'
gem 'gibbon'
gem 'high_voltage'
gem 'simple_form'
group :development do
  gem 'better_errors'
  gem 'quiet_assets'
  gem 'rails_layout'
end

Development.rb:

   Rails.application.configure do
  # Settings specified here will take precedence over those in config/application.rb.

  # In the development environment your application's code is reloaded on
  # every request. This slows down response time but is perfect for development
  # since you don't have to restart the web server when you make code changes.
  config.cache_classes = false

  # Do not eager load code on boot.
  config.eager_load = false

  # Show full error reports and disable caching.
  config.consider_all_requests_local       = true
  config.action_controller.perform_caching = false

  # Don't care if the mailer can't send.
  config.action_mailer.raise_delivery_errors = false

  # Print deprecation notices to the Rails logger.
  config.active_support.deprecation = :log

  # Raise an error on page load if there are pending migrations.
  config.active_record.migration_error = :page_load

  # Debug mode disables concatenation and preprocessing of assets.
  # This option may cause significant delays in view rendering with a large
  # number of complex assets.
  config.assets.debug = true

  config.action_mailer.smtp_settings = {
    address: "smtp.sendgrid.net",
    port: 587, # can use port 25, 587 or 2525
    domain: Rails.application.secrets.domain_name,
    authentication: "plain",
    user_name: Rails.application.secrets.email_provider_username,
    password: Rails.application.secrets.email_provider_password,
  }
  # ActionMailer config
  config.action_mailer.default_url_options = { :host => 'localhost:3000' }
    config.action_mailer.delivery_method = :smtp
    config.action_mailer.raise_delivery_errors = true
  # Send email in development mode?
  config.action_mailer.perform_deliveries = true

  # Asset digests allow you to set far-future HTTP expiration dates on all assets,
  # yet still be able to expire them through the digest params.
  config.assets.digest = true

  # Adds additional error checking when serving assets at runtime.
  # Checks for improperly declared sprockets dependencies.
  # Raises helpful error messages.
  config.assets.raise_runtime_errors = true

  # Raises error for missing translations
  # config.action_view.raise_on_missing_translations = true
end

Solution

  • on line #30, change action.mailer to action_mailer... should work