Rails 4.1.1 with console in production - ruby-on-rails

I keep getting this error since updating to rails 4.1.1 and starting my console in production as: RAILS_ENV=production rails c
load error: /home/tristan/.rvm/rubies/ruby-2.1.1/.irbrc
NoMethodError: undefined method `split' for nil:NilClass
/home/tristan/.rvm/scripts/irbrc.rb:41:in `<top (required)>'
/home/tristan/joggle/shared/bundle/ruby/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require'
/home/tristan/joggle/shared/bundle/ruby/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `block in require'
/home/tristan/joggle/shared/bundle/ruby/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:232:in `load_dependency'
/home/tristan/joggle/shared/bundle/ruby/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require'
/home/tristan/.rvm/rubies/ruby-2.1.1/.irbrc:11:in `<top (required)>'
/home/tristan/joggle/shared/bundle/ruby/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:241:in `load'
/home/tristan/joggle/shared/bundle/ruby/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:241:in `block in load'
/home/tristan/joggle/shared/bundle/ruby/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:232:in `load_dependency'
/home/tristan/joggle/shared/bundle/ruby/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:241:in `load'
/home/tristan/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/irb/init.rb:236:in `run_config'
/home/tristan/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/irb/init.rb:19:in `setup'
/home/tristan/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/irb.rb:380:in `start'
/home/tristan/joggle/shared/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/commands/console.rb:90:in `start'
/home/tristan/joggle/shared/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/commands/console.rb:9:in `start'
/home/tristan/joggle/shared/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:69:in `console'
/home/tristan/joggle/shared/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
/home/tristan/joggle/shared/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/commands.rb:17:in `<top (required)>'

I just had this same issue. I ran 'spring stop' then 'rails c' and it corrected the error. Something got mucked up with the environment because line 41 of that irbrc.rb file refers to the ENV variable GEM_HOME, which I confirmed was actually set.
Does that fix your issue?

Related

undefined method `load_defaults' on rails generate migration and rails console

I'm getting this error when I run: rails generate migration AddRoleToBuyer role:integer
The error:
/usr/lib/ruby/vendor_ruby/rails/railtie/configuration.rb:95:in `method_missing': undefined method `load_defaults' for #<Rails::Application::Configuration:0x000055e8c09a10d8> (NoMethodError)
from /home/murilo/projects/api-service/config/application.rb:24:in `<class:Application>'
from /home/murilo/projects/api-service/config/application.rb:22:in `<module:ApiService>'
from /home/murilo/projects/api-service/config/application.rb:21:in `<top (required)>'
from /home/murilo/projects/api-service/vendor/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:92:in `require'
from /home/murilo/projects/api-service/vendor/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:92:in `preload'
from /home/murilo/projects/api-service/vendor/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:153:in `serve'
from /home/murilo/projects/api-service/vendor/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:141:in `block in run'
from /home/murilo/projects/api-service/vendor/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:135:in `loop'
from /home/murilo/projects/api-service/vendor/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:135:in `run'
from /home/murilo/projects/api-service/vendor/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/application/boot.rb:19:in `<top (required)>'
from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
from -e:1:in `<main>'
The application and rspec tests is running with no problems, but migrations not working.
EDIT: this is happening when I run rails console too.

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

Error when launching a new rails app in Ubuntu 14.04

I am trying to create a new rails app on Ubuntu 14.04. This is my first time using Rails in Ubuntu, (previously developed in Windows 10). I set up the development environment, my ruby version is ruby 2.3.0p0 and rails version is 5.0.0. Once my dev environment was set up, I started a new project by typing in a terminal:
rails new MyApp
Then, I typed:
cd MyApp
bundle install
And finally, I attempted to start my rails server by typing:
rails s
Instead of the rails server starting, I get this response in the terminal:
/home/rusty/.rvm/gems/ruby-2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:89:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'uglifier'. (Bundler::GemRequireError)
Gem Load Error is: Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes.
Backtrace for gem load error is:
/home/rusty/.rvm/gems/ruby-2.3.0/gems/execjs-2.7.0/lib/execjs/runtimes.rb:58:in `autodetect'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/execjs-2.7.0/lib/execjs.rb:5:in `<module:ExecJS>'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/execjs-2.7.0/lib/execjs.rb:4:in `<top (required)>'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/uglifier-3.0.0/lib/uglifier.rb:5:in `require'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/uglifier-3.0.0/lib/uglifier.rb:5:in `<top (required)>'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:86:in `require'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:86:in `block (2 levels) in require'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:81:in `each'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:81:in `block in require'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:70:in `each'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:70:in `require'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/bundler-1.12.5/lib/bundler.rb:102:in `require'
/home/rusty/Maple/config/application.rb:7:in `<top (required)>'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:88:in `require'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:88:in `block in server'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:85:in `tap'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:85:in `server'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0/lib/rails/commands.rb:18:in `<top (required)>'
/home/rusty/Maple/bin/rails:9:in `require'
/home/rusty/Maple/bin/rails:9:in `<top (required)>'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/client/rails.rb:28:in `load'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/client/rails.rb:28:in `call'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/client/command.rb:7:in `call'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/client.rb:30:in `run'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/bin/spring:49:in `<top (required)>'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/binstub.rb:11:in `load'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/binstub.rb:11:in `<top (required)>'
/home/rusty/Maple/bin/spring:13:in `require'
/home/rusty/Maple/bin/spring:13:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
Bundler Error Backtrace:
from /home/rusty/.rvm/gems/ruby-2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:85:in `block (2 levels) in require'
from /home/rusty/.rvm/gems/ruby-2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:81:in `each'
from /home/rusty/.rvm/gems/ruby-2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:81:in `block in require'
from /home/rusty/.rvm/gems/ruby-2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:70:in `each'
from /home/rusty/.rvm/gems/ruby-2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:70:in `require'
from /home/rusty/.rvm/gems/ruby-2.3.0/gems/bundler-1.12.5/lib/bundler.rb:102:in `require'
from /home/rusty/Maple/config/application.rb:7:in `<top (required)>'
from /home/rusty/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:88:in `require'
from /home/rusty/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:88:in `block in server'
from /home/rusty/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:85:in `tap'
from /home/rusty/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:85:in `server'
from /home/rusty/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
from /home/rusty/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0/lib/rails/commands.rb:18:in `<top (required)>'
from /home/rusty/Maple/bin/rails:9:in `require'
from /home/rusty/Maple/bin/rails:9:in `<top (required)>'
from /home/rusty/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/client/rails.rb:28:in `load'
from /home/rusty/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/client/rails.rb:28:in `call'
from /home/rusty/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/client/command.rb:7:in `call'
from /home/rusty/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/client.rb:30:in `run'
from /home/rusty/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/bin/spring:49:in `<top (required)>'
from /home/rusty/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/binstub.rb:11:in `load'
from /home/rusty/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/binstub.rb:11:in `<top (required)>'
from /home/rusty/Maple/bin/spring:13:in `require'
from /home/rusty/Maple/bin/spring:13:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'
My app was created successfully. All the appropriate files are located in my app's folder. I just can't seem to get the rails server to start.
I found a solution. Open a terminal and change to your app's directory. Example, type cd MyApp.
Then install the Rubyracer gem by typing gem install therubyracer in your terminal, and then add gem 'therubyracer' to your gemfile.
My rails server starts now. Thank you uDaY for helping me.

Rails Error: `method_missing': undefined method `register_middleware'

On Rails, I'm trying to rake a new task I just created and it's giving me an undefined method error:
syck has been removed, psych is used instead
rake aborted!
NoMethodError: undefined method `register_middleware' for #<Faraday::Connection:0x007f8773f41288>
/Library/Ruby/Gems/2.0.0/gems/faraday-0.9.0/lib/faraday.rb:99:in `method_missing'
/Library/Ruby/Gems/2.0.0/gems/balanced-0.8.1/lib/balanced/client.rb:41:in `build_conn'
/Library/Ruby/Gems/2.0.0/gems/balanced-0.8.1/lib/balanced/client.rb:30:in `initialize'
/Library/Ruby/Gems/2.0.0/gems/balanced-0.8.1/lib/balanced.rb:29:in `new'
/Library/Ruby/Gems/2.0.0/gems/balanced-0.8.1/lib/balanced.rb:29:in `configure'
/Library/Ruby/Gems/2.0.0/gems/balanced-0.8.1/lib/balanced.rb:86:in `<module:Balanced>'
/Library/Ruby/Gems/2.0.0/gems/balanced-0.8.1/lib/balanced.rb:11:in `<top (required)>'
/Library/Ruby/Gems/2.0.0/gems/bundler-1.6.2/lib/bundler/runtime.rb:76:in `require'
/Library/Ruby/Gems/2.0.0/gems/bundler-1.6.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
/Library/Ruby/Gems/2.0.0/gems/bundler-1.6.2/lib/bundler/runtime.rb:72:in `each'
/Library/Ruby/Gems/2.0.0/gems/bundler-1.6.2/lib/bundler/runtime.rb:72:in `block in require'
/Library/Ruby/Gems/2.0.0/gems/bundler-1.6.2/lib/bundler/runtime.rb:61:in `each'
/Library/Ruby/Gems/2.0.0/gems/bundler-1.6.2/lib/bundler/runtime.rb:61:in `require'
/Library/Ruby/Gems/2.0.0/gems/bundler-1.6.2/lib/bundler.rb:132:in `require'
/Users/Stephanie/Desktop/Pixiboard/config/application.rb:8:in `<top (required)>'
/Users/Stephanie/Desktop/Pixiboard/Rakefile:5:in `<top (required)>'
(See full trace by running task with --trace)
I also get a similar error when trying to run the command "rails console" (to see if there's anything wrong with my task):
syck has been removed, psych is used instead
/Library/Ruby/Gems/2.0.0/gems/faraday-0.9.0/lib/faraday.rb:99:in `method_missing': undefined method `register_middleware' for #<Faraday::Connection:0x007f986c506700> (NoMethodError)
from /Library/Ruby/Gems/2.0.0/gems/balanced-0.8.1/lib/balanced/client.rb:41:in `build_conn'
from /Library/Ruby/Gems/2.0.0/gems/balanced-0.8.1/lib/balanced/client.rb:30:in `initialize'
from /Library/Ruby/Gems/2.0.0/gems/balanced-0.8.1/lib/balanced.rb:29:in `new'
from /Library/Ruby/Gems/2.0.0/gems/balanced-0.8.1/lib/balanced.rb:29:in `configure'
from /Library/Ruby/Gems/2.0.0/gems/balanced-0.8.1/lib/balanced.rb:86:in `<module:Balanced>'
from /Library/Ruby/Gems/2.0.0/gems/balanced-0.8.1/lib/balanced.rb:11:in `<top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.6.2/lib/bundler/runtime.rb:76:in `require'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.6.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.6.2/lib/bundler/runtime.rb:72:in `each'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.6.2/lib/bundler/runtime.rb:72:in `block in require'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.6.2/lib/bundler/runtime.rb:61:in `each'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.6.2/lib/bundler/runtime.rb:61:in `require'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.6.2/lib/bundler.rb:132:in `require'
from /Users/Stephanie/Desktop/Pixiboard/config/application.rb:8:in `<top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/railties-3.2.12/lib/rails/commands.rb:39:in `require'
from /Library/Ruby/Gems/2.0.0/gems/railties-3.2.12/lib/rails/commands.rb:39:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Can anyone help me on what to do?
(I'm on Rails 3.2.12)
balanced-ruby is not yet compatible with faraday 0.9.0. See more balanced-ruby/issues/173
and try to use faraday 0.8.6 in your Gemfile:
gem 'faraday', '~> 0.8.6'

bundle console fails w/ uninitialized constant Rails

I have create a new Rails engine using the rails plugin new Foobar --full --mountable command. When running bundle console I get uninitialized constant Rails Why is this?
Resolving dependencies...
Unfortunately, a fatal error has occurred. Please see the Bundler troubleshooting documentation at http://bit.ly/bundler-issues. Thanks!
/Users/kyledecot/Desktop/Foobar/lib/foobar/engine.rb:2:in `<module:Foobar>': uninitialized constant Rails (NameError)
from /Users/kyledecot/Desktop/Foobar/lib/foobar/engine.rb:1:in `<top (required)>'
from /Users/kyledecot/Desktop/Foobar/lib/foobar.rb:1:in `require'
from /Users/kyledecot/Desktop/Foobar/lib/foobar.rb:1:in `<top (required)>'
from /Users/kyledecot/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.5.1/lib/bundler/runtime.rb:76:in `require'
from /Users/kyledecot/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.5.1/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from /Users/kyledecot/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.5.1/lib/bundler/runtime.rb:72:in `each'
from /Users/kyledecot/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.5.1/lib/bundler/runtime.rb:72:in `block in require'
from /Users/kyledecot/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.5.1/lib/bundler/runtime.rb:61:in `each'
from /Users/kyledecot/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.5.1/lib/bundler/runtime.rb:61:in `require'
from /Users/kyledecot/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.5.1/lib/bundler.rb:131:in `require'
from /Users/kyledecot/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.5.1/lib/bundler/cli.rb:664:in `console'
from /Users/kyledecot/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.5.1/lib/bundler/vendor/thor/command.rb:27:in `run'
from /Users/kyledecot/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.5.1/lib/bundler/vendor/thor/invocation.rb:120:in `invoke_command'
from /Users/kyledecot/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.5.1/lib/bundler/vendor/thor.rb:363:in `dispatch'
from /Users/kyledecot/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.5.1/lib/bundler/vendor/thor/base.rb:438:in `start'
from /Users/kyledecot/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.5.1/lib/bundler/cli.rb:10:in `start'
from /Users/kyledecot/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.5.1/bin/bundle:22:in `block in <top (required)>'
from /Users/kyledecot/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.5.1/lib/bundler/friendly_errors.rb:5:in `with_friendly_errors'
from /Users/kyledecot/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.5.1/bin/bundle:22:in `<top (required)>'
from /Users/kyledecot/.rvm/gems/ruby-2.0.0-p353#global/bin/bundle:23:in `load'
from /Users/kyledecot/.rvm/gems/ruby-2.0.0-p353#global/bin/bundle:23:in `<main>'
from /Users/kyledecot/.rvm/gems/ruby-2.0.0-p353#foobar/bin/ruby_executable_hooks:15:in `eval'
from /Users/kyledecot/.rvm/gems/ruby-2.0.0-p353#foobar/bin/ruby_executable_hooks:15:in `<main>'
Adding require 'rails' in Foobar/lib/foobar/engine.rb file worked for me. I got my answer from here.

Resources