Is there something wrong with this Rails Console error message? - ruby-on-rails

Very new to Rails, so bear with me -
Currently paranoid that my ruby and gem versions aren't up to date because I'd occasionally get error messages when running rails test. Previously had rvm and rbenv both installed, but wow I've removed both and reinstalled rvm only.
When I go into a irb and call an action that doesn't work, such as: "foo".select, I get a simple error message:
NoMethodError: private method 'select' called for "foo":String
from (irb):4
from /Users/Joseph/.rvm/rubies/ruby-2.3.1/bin/irb:11:in '<main>'
However, when I type the same command "foo".select in rails console instead, I get:
NoMethodError: private method `select' called for "foo":String
from (irb):1
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/railties-5.0.0.1/lib/rails/commands/console.rb:65:in `start'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/railties-5.0.0.1/lib/rails/commands/console_helper.rb:9:in `start'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:78:in `console'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/railties-5.0.0.1/lib/rails/commands.rb:18:in `<top (required)>'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `block in require'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:259:in `load_dependency'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
from /Users/Joseph/workspace/sample_app/bin/rails:9:in `<top (required)>'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:287:in `load'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:287:in `block in load'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:259:in `load_dependency'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:287:in `load'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/spring-1.7.2/lib/spring/commands/rails.rb:6:in `call'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/spring-1.7.2/lib/spring/command_wrapper.rb:38:in `call'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/spring-1.7.2/lib/spring/application.rb:191:in `block in serve'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/spring-1.7.2/lib/spring/application.rb:161:in `fork'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/spring-1.7.2/lib/spring/application.rb:161:in `serve'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/spring-1.7.2/lib/spring/application.rb:131:in `block in run'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/spring-1.7.2/lib/spring/application.rb:125:in `loop'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/spring-1.7.2/lib/spring/application.rb:125:in `run'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/spring-1.7.2/lib/spring/application/boot.rb:19:in `<top (required)>'
from /Users/Joseph/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/Joseph/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'
Is this normal? Or is there something wrong with my gems here?

There's nothing wrong with your gems. The thing is that when you run irb, it's just that. You only run the ruby interactive.
When you run rails console in order to show you the console it needs to go and set it for you with ActiveRecord, rails core, etc. So this (below) is all it does before it's set.
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/railties-5.0.0.1/lib/rails/commands/console.rb:65:in `start'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/railties-5.0.0.1/lib/rails/commands/console_helper.rb:9:in `start'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:78:in `console'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/railties-5.0.0.1/lib/rails/commands.rb:18:in `<top (required)>'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `block in require'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:259:in `load_dependency'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
from /Users/Joseph/workspace/sample_app/bin/rails:9:in `<top (required)>'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:287:in `load'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:287:in `block in load'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:259:in `load_dependency'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:287:in `load'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/spring-1.7.2/lib/spring/commands/rails.rb:6:in `call'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/spring-1.7.2/lib/spring/command_wrapper.rb:38:in `call'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/spring-1.7.2/lib/spring/application.rb:191:in `block in serve'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/spring-1.7.2/lib/spring/application.rb:161:in `fork'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/spring-1.7.2/lib/spring/application.rb:161:in `serve'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/spring-1.7.2/lib/spring/application.rb:131:in `block in run'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/spring-1.7.2/lib/spring/application.rb:125:in `loop'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/spring-1.7.2/lib/spring/application.rb:125:in `run'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/spring-1.7.2/lib/spring/application/boot.rb:19:in `<top (required)>'
from /Users/Joseph/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/Joseph/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'
Notice that irb is executed really fast, while rails console takes its time, depending on your initializers, configurations, etc.

Related

I have issues starting the server

I am new to the ruby environment. I configured ruby and when I start the server I am hit with the series of errors. Can someone please give me a hand please.
2.3.1 :001 > rails s
NameError: undefined local variable or method `s' for main:Object
from (irb):1
from /Users/User/.rvm/gems/ruby-2.3.1/gems/railties-4.2.6/lib/rails/commands/console.rb:110:in `start'
from /Users/User/.rvm/gems/ruby-2.3.1/gems/railties-4.2.6/lib/rails/commands/console.rb:9:in `start'
from /Users/User/.rvm/gems/ruby-2.3.1/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:68:in `console'
from /Users/User/.rvm/gems/ruby-2.3.1/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /Users/User/.rvm/gems/ruby-2.3.1/gems/railties-4.2.6/lib/rails/commands.rb:17:in `<top (required)>'
from /Users/User/.rvm/gems/ruby-2.3.1/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
from /Users/User/.rvm/gems/ruby-2.3.1/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `block in require'
from /Users/User/.rvm/gems/ruby-2.3.1/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:in `load_dependency'
from /Users/User/.rvm/gems/ruby-2.3.1/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
from /Users/User/workspace/dineconnect-backend/bin/rails:9:in `<top (required)>'
from /Users/User/.rvm/gems/ruby-2.3.1/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:268:in `load'
from /Users/User/.rvm/gems/ruby-2.3.1/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:268:in `block in load'
from /Users/User/.rvm/gems/ruby-2.3.1/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:in `load_dependency'
from /Users/User/.rvm/gems/ruby-2.3.1/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:268:in `load'
from /Users/User/.rvm/gems/ruby-2.3.1/gems/spring-2.0.0/lib/spring/commands/rails.rb:6:in `call'
from /Users/User/.rvm/gems/ruby-2.3.1/gems/spring-2.0.0/lib/spring/command_wrapper.rb:38:in `call'
from /Users/User/.rvm/gems/ruby-2.3.1/gems/spring-2.0.0/lib/spring/application.rb:191:in `block in serve'
from /Users/User/.rvm/gems/ruby-2.3.1/gems/spring-2.0.0/lib/spring/application.rb:161:in `fork'
from /Users/User/.rvm/gems/ruby-2.3.1/gems/spring-2.0.0/lib/spring/application.rb:161:in `serve'
from /Users/User/.rvm/gems/ruby-2.3.1/gems/spring-2.0.0/lib/spring/application.rb:131:in `block in run'
from /Users/User/.rvm/gems/ruby-2.3.1/gems/spring-2.0.0/lib/spring/application.rb:125:in `loop'
from /Users/User/.rvm/gems/ruby-2.3.1/gems/spring-2.0.0/lib/spring/application.rb:125:in `run'
from /Users/User/.rvm/gems/ruby-2.3.1/gems/spring-2.0.0/lib/spring/application/boot.rb:19:in `<top (required)>'
from /Users/User/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/User/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'
You are trying to start rails server in interactive Ruby Shell (IRB or irb), or may be rails console.
use the command
rails s
in your terminal
You should have to look into this http://guides.rubyonrails.org/getting_started.html for the rails basics.
You are using rails console. Get out of the console by typing quit and then type rails s

Shows error when run 'rails g rails_admin:install' command

I was trying to install rails_admin gem in my rails app.I followed this document. But when I run the command rails g rails_admin:install it shows the following error.
Running via Spring preloader in process 51535
? Where do you want to mount rails_admin? Press <enter> for [admin] > /Users/home/.rbenv/versions/2.2.3/gemsets/voiceover/gems/thor-0.19.1/lib/thor/line_editor/readline.rb:20:in `readline': Input/output error - read (Errno::EIO)
from /Users/home/.rbenv/versions/2.2.3/gemsets/voiceover/gems/thor-0.19.1/lib/thor/line_editor/readline.rb:20:in `readline'
from /Users/home/.rbenv/versions/2.2.3/gemsets/voiceover/gems/thor-0.19.1/lib/thor/line_editor.rb:7:in `readline'
from /Users/home/.rbenv/versions/2.2.3/gemsets/voiceover/gems/thor-0.19.1/lib/thor/shell/basic.rb:395:in `ask_simply'
from /Users/home/.rbenv/versions/2.2.3/gemsets/voiceover/gems/thor-0.19.1/lib/thor/shell/basic.rb:68:in `ask'
from /Users/home/.rbenv/versions/2.2.3/gemsets/voiceover/gems/thor-0.19.1/lib/thor/shell.rb:59:in `ask'
from /Users/home/.rbenv/versions/2.2.3/gemsets/voiceover/gems/rails_admin-0.8.1/lib/generators/rails_admin/utils.rb:13:in `ask_for'
from /Users/home/.rbenv/versions/2.2.3/gemsets/voiceover/gems/rails_admin-0.8.1/lib/generators/rails_admin/install_generator.rb:13:in `install'
from /Users/home/.rbenv/versions/2.2.3/gemsets/voiceover/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
from /Users/home/.rbenv/versions/2.2.3/gemsets/voiceover/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
from /Users/home/.rbenv/versions/2.2.3/gemsets/voiceover/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `block in invoke_all'
from /Users/home/.rbenv/versions/2.2.3/gemsets/voiceover/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `each'
from /Users/home/.rbenv/versions/2.2.3/gemsets/voiceover/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `map'
from /Users/home/.rbenv/versions/2.2.3/gemsets/voiceover/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `invoke_all'
from /Users/home/.rbenv/versions/2.2.3/gemsets/voiceover/gems/thor-0.19.1/lib/thor/group.rb:232:in `dispatch'
from /Users/home/.rbenv/versions/2.2.3/gemsets/voiceover/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
from /Users/home/.rbenv/versions/2.2.3/gemsets/voiceover/gems/railties-4.2.5.1/lib/rails/generators.rb:157:in `invoke'
from /Users/home/.rbenv/versions/2.2.3/gemsets/voiceover/gems/railties-4.2.5.1/lib/rails/commands/generate.rb:13:in `<top (required)>'
from /Users/home/.rbenv/versions/2.2.3/gemsets/voiceover/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:274:in `require'
from /Users/home/.rbenv/versions/2.2.3/gemsets/voiceover/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:274:in `block in require'
from /Users/home/.rbenv/versions/2.2.3/gemsets/voiceover/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:240:in `load_dependency'
from /Users/home/.rbenv/versions/2.2.3/gemsets/voiceover/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:274:in `require'
from /Users/home/.rbenv/versions/2.2.3/gemsets/voiceover/gems/railties-4.2.5.1/lib/rails/commands/commands_tasks.rb:123:in `require_command!'
from /Users/home/.rbenv/versions/2.2.3/gemsets/voiceover/gems/railties-4.2.5.1/lib/rails/commands/commands_tasks.rb:130:in `generate_or_destroy'
from /Users/home/.rbenv/versions/2.2.3/gemsets/voiceover/gems/railties-4.2.5.1/lib/rails/commands/commands_tasks.rb:50:in `generate'
from /Users/home/.rbenv/versions/2.2.3/gemsets/voiceover/gems/railties-4.2.5.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /Users/home/.rbenv/versions/2.2.3/gemsets/voiceover/gems/railties-4.2.5.1/lib/rails/commands.rb:17:in `<top (required)>'
from /Users/home/.rbenv/versions/2.2.3/gemsets/voiceover/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:274:in `require'
from /Users/home/.rbenv/versions/2.2.3/gemsets/voiceover/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:274:in `block in require'
from /Users/home/.rbenv/versions/2.2.3/gemsets/voiceover/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:240:in `load_dependency'
from /Users/home/.rbenv/versions/2.2.3/gemsets/voiceover/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:274:in `require'
from /Users/home/Neethu/Projects/Rails/Personal/SampleRailsAdmin/bin/rails:9:in `<top (required)>'
from /Users/home/.rbenv/versions/2.2.3/gemsets/voiceover/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:268:in `load'
from /Users/home/.rbenv/versions/2.2.3/gemsets/voiceover/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:268:in `block in load'
from /Users/home/.rbenv/versions/2.2.3/gemsets/voiceover/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:240:in `load_dependency'
from /Users/home/.rbenv/versions/2.2.3/gemsets/voiceover/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:268:in `load'
from /Users/home/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/home/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'
I am using gemset with Ruby version 2.2.3 and Rails version 4.2.5.
Please suggest some solution.Thanks in advance
After restarting the system it got worked !!!

Shorten Error Message in Terminal

Rails error messages in terminal are too long and contain often useless information. Is there a gem/solution to shorten rails error messages?
Example:
2.2.2 :012 > puts 1.red
What I currently get:
NoMethodError: undefined method `red' for 1:Fixnum
from (irb):12
from /Users/Ben/.rvm/gems/ruby-2.2.2#global/gems/railties- 4.2.1/lib/rails/commands/console.rb:110:in `start'
from /Users/Ben/.rvm/gems/ruby-2.2.2#global/gems/railties-4.2.1/lib/rails/commands/console.rb:9:in `start'
from /Users/Ben/.rvm/gems/ruby-2.2.2#global/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:68:in `console'
from /Users/Ben/.rvm/gems/ruby-2.2.2#global/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /Users/Ben/.rvm/gems/ruby-2.2.2#global/gems/railties-4.2.1/lib/rails/commands.rb:17:in `<top (required)>'
from /Users/Ben/.rvm/gems/ruby-2.2.2#global/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require'
from /Users/Ben/.rvm/gems/ruby-2.2.2#global/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `block in require'
from /Users/Ben/.rvm/gems/ruby-2.2.2#global/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:in `load_dependency'
from /Users/Ben/.rvm/gems/ruby-2.2.2#global/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require'
from /Users/Ben/coding/krokoapp/bin/rails:8:in `<top (required)>'
from /Users/Ben/.rvm/gems/ruby-2.2.2#global/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:in `load'
from /Users/Ben/.rvm/gems/ruby-2.2.2#global/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:in `block in load'
from /Users/Ben/.rvm/gems/ruby-2.2.2#global/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:in `load_dependency'
from /Users/Ben/.rvm/gems/ruby-2.2.2#global/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:in `load'
from /Users/Ben/.rvm/gems/ruby-2.2.2#rails-devise-roles/gems/spring-1.3.6/lib/spring/commands/rails.rb:6:in `call'
from /Users/Ben/.rvm/gems/ruby-2.2.2#rails-devise-roles/gems/spring-1.3.6/lib/spring/command_wrapper.rb:38:in `call'
from /Users/Ben/.rvm/gems/ruby-2.2.2#rails-devise-roles/gems/spring-1.3.6/lib/spring/application.rb:183:in `block in serve'
from /Users/Ben/.rvm/gems/ruby-2.2.2#rails-devise-roles/gems/spring-1.3.6/lib/spring/application.rb:156:in `fork'
from /Users/Ben/.rvm/gems/ruby-2.2.2#rails-devise-roles/gems/spring-1.3.6/lib/spring/application.rb:156:in `serve'
from /Users/Ben/.rvm/gems/ruby-2.2.2#rails-devise-roles/gems/spring-1.3.6/lib/spring/application.rb:131:in `block in run'
from /Users/Ben/.rvm/gems/ruby-2.2.2#rails-devise-roles/gems/spring-1.3.6/lib/spring/application.rb:125:in `loop'
from /Users/Ben/.rvm/gems/ruby-2.2.2#rails-devise-roles/gems/spring-1.3.6/lib/spring/application.rb:125:in `run'
from /Users/Ben/.rvm/gems/ruby-2.2.2#rails-devise-roles/gems/spring-1.3.6/lib/spring/application/boot.rb:18:in `<top (required)>'
from /Users/Ben/.rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/Ben/.rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from -e:1:in `<main>'2.2.2 :013 >
What I want: (optionally in red)
NoMethodError: undefined method `red' for 1:Fixnum
===>Long error message saved in e. Get full messages with 'puts e'
Would this be possible?
You could try better_errors gem.
It provides also a better explanation of the errors via browser.
This is the link to the github repo
EDIT
If you are looking also to a customizable console (also the exception trace) try to see pry

NoMethodError in undefined method `scoped' in rails (using ancestry gem)

I am using the ancestry gem and i m testing my model in the console first.When i use
root = Message.create(:content => "hello")
It inserts data into the database but when i use
child = root.children.create(:content => "hhjjh")
It gives an error.This is the log
NoMethodError: undefined method `scoped' for #<Class:0x007fa4a61182b0>
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/dynamic_matchers.rb:26:in `method_missing'
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/ancestry-1.2.3/lib/ancestry/instance_methods.rb:136:in `children'
from (irb):2
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/railties-4.1.8/lib/rails/commands/console.rb:90:in `start'
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/railties-4.1.8/lib/rails/commands/console.rb:9:in `start'
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:69:in `console'
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/railties-4.1.8/lib/rails/commands.rb:17:in `<top (required)>'
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:247:in `require'
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:247:in `block in require'
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:232:in `load_dependency'
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:247:in `require'
from /Users/zeeshandar/chat/bin/rails:8:in `<top (required)>'
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:241:in `load'
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:241:in `block in load'
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:232:in `load_dependency'
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:241:in `load'
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/spring-1.2.0/lib/spring/commands/rails.rb:6:in `call'
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/spring-1.2.0/lib/spring/command_wrapper.rb:38:in `call'
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/spring-1.2.0/lib/spring/application.rb:183:in `block in serve'
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/spring-1.2.0/lib/spring/application.rb:156:in `fork'
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/spring-1.2.0/lib/spring/application.rb:156:in `serve'
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/spring-1.2.0/lib/spring/application.rb:131:in `block in run'
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/spring-1.2.0/lib/spring/application.rb:125:in `loop'
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/spring-1.2.0/lib/spring/application.rb:125:in `run'
from /Users/zeeshandar/.rvm/gems/ruby-2.1.5/gems/spring-1.2.0/lib/spring/application/boot.rb:18:in `<top (required)>'
from /Users/zeeshandar/.rbenv/versions/2.1.3/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/zeeshandar/.rbenv/versions/2.1.3/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
I don't know what i m doing wrong but i think this is suppose to work.Any ideas?
It looks like your version of Ancestry is 1.2.3 or something. Updating to a new version looks like it should fix that problem.
Gemfile
gem 'ancestry', '~> 2.1'

Unwanted lines in rails console error reporting

?> error
NameError: undefined local variable or method `error' for main:Object
from (irb):7
from /usr/local/rvm/gems/ruby-2.1.4#rails4/gems/railties-4.2.0.beta4/lib/rails/commands/console.rb:110:in `start'
from /usr/local/rvm/gems/ruby-2.1.4#rails4/gems/railties-4.2.0.beta4/lib/rails/commands/console.rb:9:in `start'
from /usr/local/rvm/gems/ruby-2.1.4#rails4/gems/railties-4.2.0.beta4/lib/rails/commands/commands_tasks.rb:68:in `console'
from /usr/local/rvm/gems/ruby-2.1.4#rails4/gems/railties-4.2.0.beta4/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /usr/local/rvm/gems/ruby-2.1.4#rails4/gems/railties-4.2.0.beta4/lib/rails/commands.rb:17:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activesupport-4.2.0.beta4/lib/active_support/dependencies.rb:252:in `require'
from /usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activesupport-4.2.0.beta4/lib/active_support/dependencies.rb:252:in `block in require'
from /usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activesupport-4.2.0.beta4/lib/active_support/dependencies.rb:237:in `load_dependency'
from /usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activesupport-4.2.0.beta4/lib/active_support/dependencies.rb:252:in `require'
from /home/ubuntu/workspace/sample_app/bin/rails:8:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activesupport-4.2.0.beta4/lib/active_support/dependencies.rb:246:in `load'
from /usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activesupport-4.2.0.beta4/lib/active_support/dependencies.rb:246:in `block in load'
from /usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activesupport-4.2.0.beta4/lib/active_support/dependencies.rb:237:in `load_dependency'
from /usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activesupport-4.2.0.beta4/lib/active_support/dependencies.rb:246:in `load'
from /usr/local/rvm/gems/ruby-2.1.4#rails4/gems/spring-1.1.3/lib/spring/commands/rails.rb:6:in `call'
from /usr/local/rvm/gems/ruby-2.1.4#rails4/gems/spring-1.1.3/lib/spring/command_wrapper.rb:38:in `call'
from /usr/local/rvm/gems/ruby-2.1.4#rails4/gems/spring-1.1.3/lib/spring/application.rb:180:in `block in serve'
from /usr/local/rvm/gems/ruby-2.1.4#rails4/gems/spring-1.1.3/lib/spring/application.rb:153:in `fork'
from /usr/local/rvm/gems/ruby-2.1.4#rails4/gems/spring-1.1.3/lib/spring/application.rb:153:in `serve'
from /usr/local/rvm/gems/ruby-2.1.4#rails4/gems/spring-1.1.3/lib/spring/application.rb:128:in `block in run'
from /usr/local/rvm/gems/ruby-2.1.4#rails4/gems/spring-1.1.3/lib/spring/application.rb:122:in `loop'
from /usr/local/rvm/gems/ruby-2.1.4#rails4/gems/spring-1.1.3/lib/spring/application.rb:122:in `run'
from /usr/local/rvm/gems/ruby-2.1.4#rails4/gems/spring-1.1.3/lib/spring/application/boot.rb:18:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-2.1.4/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /usr/local/rvm/rubies/ruby-2.1.4/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from -e:1:in `<main>'
In rails console when I commit an error, the console displays tons of lines which I don't want to see. Can this be silenced?
I've found that you can add this line:
Rails.backtrace_cleaner.add_silencer { |line| line =~ /rvm/ }
in config/initializers/backtrace_silencers.rb but this doesn't resolve the problem.

Resources