Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rails console exits with a each_registered_block': undefined method each' for nil:NilClass (NoMethodError)` [rails 5.0.0.beta1.1] #23300

Closed
gnerkus opened this issue Jan 28, 2016 · 7 comments

Comments

@gnerkus
Copy link

gnerkus commented Jan 28, 2016

Hello,

I have a rails 5.0.0.beta1.1 application rvm 1.26.11 / ruby 2.2.3p173 application installed locally. I've been able to run the rails server and rails generate commands without problems. Unfortunately, the rails console command exits with an error.

$ rails console returns the following:

/Users/gnerkus/.rvm/gems/ruby-2.2.3@rails-experiments/gems/railties-5.0.0.beta1.1/lib/rails/railtie.rb:245:in 
`each_registered_block': undefined method `each' for nil:NilClass (NoMethodError)

This is my Gemfile:

source 'https://rubygems.org'


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '>= 5.0.0.beta1.1', '< 5.1'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# Use Puma as the app server
gem 'puma'

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug'
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> in views
  gem 'web-console', '~> 3.0'

  gem 'rubocop'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
@prathamesh-sonpatki
Copy link
Member

Can you please provide a sample application that reproduces the error?

@gnerkus
Copy link
Author

gnerkus commented Jan 28, 2016

I can outline the commands I ran until I received the error:

$ rvm gemset create rails-experiments
$ rvm gemset use rails-experiments
$ gem install rails --pre
$ rails new chatter --skip-spring
$ rails g controller rooms show
$ rails server

At this point, I added the rubocop gem. The next set of commands are detailed below:

$ bundle install
$ rails g model message content:text
$ rails console

The source files for the application:

message.rb

class Message < ApplicationRecord
end

rooms_controller.rb

#
class RoomsController < ApplicationController
  def show
    @message = Message.find(params[:id])
  end
end

routes.rb

Rails.application.routes.draw do
  root to: 'rooms#show'

  # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html

  # Serve websocket cable requests in-process
  # mount ActionCable.server => '/cable'
end

@prathamesh-sonpatki
Copy link
Member

@gnerkus Thanks for the steps. I was able to reproduce the issue and when I removed web-console gem from the Gemfile, rails console worked properly.

This issue is already reported on web-console tracker, I will move discussion there. rails/web-console#184

@prathamesh-sonpatki
Copy link
Member

Closing this issue in favor of rails/web-console#184

@prathamesh-sonpatki
Copy link
Member

@gnerkus This issue has been fixed by rails/web-console#185.

@gsamokovarov
Copy link
Contributor

Folks, please update to 3.1.1. I have yanked the 3.1.0 release, so it can't be incidentally installed anymore.

@gnerkus
Copy link
Author

gnerkus commented Jan 28, 2016

I will update to 3.1.1. Thank you @prathamesh-sonpatki , @gsamokovarov .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants