undefined local variable or method `index' for #<Bundler::Definition - ruby-on-rails-3

Every thing was working fine and once I logout and login back to my system, nothing works for Rails 3.1 on my system. On every app it throws the same error:
/home/nazar2/.rvm/gems/ruby-1.9.2-p290#rails3.1/gems/bundler-1.0.21/lib/bundler/definition.rb:151:in `resolve': undefined local variable or method `index' for #<Bundler::Definition:0x97a48d4> (NameError)
from /home/nazar2/.rvm/gems/ruby-1.9.2-p290#rails3.1/gems/bundler-1.0.21/lib/bundler/definition.rb:90:in `specs'
from /home/nazar2/.rvm/gems/ruby-1.9.2-p290#rails3.1/gems/bundler-1.0.21/lib/bundler/definition.rb:135:in `specs_for'
from /home/nazar2/.rvm/gems/ruby-1.9.2-p290#rails3.1/gems/bundler-1.0.21/lib/bundler/definition.rb:124:in `requested_specs'
from /home/nazar2/.rvm/gems/ruby-1.9.2-p290#rails3.1/gems/bundler-1.0.21/lib/bundler/environment.rb:23:in `requested_specs'
from /home/nazar2/.rvm/gems/ruby-1.9.2-p290#rails3.1/gems/bundler-1.0.21/lib/bundler/runtime.rb:11:in `setup'
from /home/nazar2/.rvm/gems/ruby-1.9.2-p290#rails3.1/gems/bundler-1.0.21/lib/bundler.rb:110:in `setup'
from /home/nazar2/.rvm/gems/ruby-1.9.2-p290#rails3.1/gems/bundler-1.0.21/lib/bundler/setup.rb:7:in `<top (required)>'
from /home/nazar2/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in `require'
from /home/nazar2/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in `rescue in require'
from /home/nazar2/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
from /home/backup/Hub/clients/orthomind/new/orthomind/config/boot.rb:6:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from script/rails:5:in `<main>'
I am stuck and can't figure out what the issue is.

Just updated to bundler gem and every things works perfectly fine.
gem install bundler --pre
I think there was some issue with previous bundler gem version with Rails3.1

Related

rails generate broken with NoMethodError

I am having some troubles with my Rails environment - running a command like:
$ rails generate scaffold_controller model_name
results in the following trace:
/Users/me/.rvm/gems/ruby-1.9.3-p392#myproject/gems/railties-3.2.13/lib/rails/generators/generated_attribute.rb:13:in `parse': undefined method `split' for :clear:Symbol (NoMethodError)
from /Users/me/.rvm/gems/ruby-1.9.3-p392#myproject/gems/railties-3.2.13/lib/rails/generators/named_base.rb:161:in `block in parse_attributes!'
from /Users/me/.rvm/gems/ruby-1.9.3-p392#myproject/gems/railties-3.2.13/lib/rails/generators/named_base.rb:160:in `map'
from /Users/me/.rvm/gems/ruby-1.9.3-p392#myproject/gems/railties-3.2.13/lib/rails/generators/named_base.rb:160:in `parse_attributes!'
from /Users/me/.rvm/gems/ruby-1.9.3-p392#myproject/gems/railties-3.2.13/lib/rails/generators/named_base.rb:21:in `initialize'
from /Users/me/.rvm/gems/ruby-1.9.3-p392#myproject/gems/railties-3.2.13/lib/rails/generators/resource_helpers.rb:18:in `initialize'
from /Users/me/.rvm/gems/ruby-1.9.3-p392#myproject/gems/thor-0.18.1/lib/thor/group.rb:227:in `new'
from /Users/me/.rvm/gems/ruby-1.9.3-p392#myproject/gems/thor-0.18.1/lib/thor/group.rb:227:in `dispatch'
from /Users/me/.rvm/gems/ruby-1.9.3-p392#myproject/gems/thor-0.18.1/lib/thor/base.rb:439:in `start'
from /Users/me/.rvm/gems/ruby-1.9.3-p392#myproject/gems/railties-3.2.13/lib/rails/generators.rb:171:in `invoke'
from /Users/me/.rvm/gems/ruby-1.9.3-p392#myproject/gems/railties-3.2.13/lib/rails/commands/generate.rb:12:in `<top (required)>'
from /Users/me/.rvm/gems/ruby-1.9.3-p392#myproject/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
from /Users/me/.rvm/gems/ruby-1.9.3-p392#myproject/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require'
from /Users/me/.rvm/gems/ruby-1.9.3-p392#myproject/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
from /Users/me/.rvm/gems/ruby-1.9.3-p392#myproject/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
from /Users/me/.rvm/gems/ruby-1.9.3-p392#myproject/gems/railties-3.2.13/lib/rails/commands.rb:29:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
As nothing in the trace seems to even be from my specific project, I'm a little stumped as to what could be going on. As you can see, I'm running rails 3.2.13 on an rvm-installed ruby 1.9.3.
Any ideas?
I had the same problem. it turns out that I had following line somewhere in my code.
include Term::ANSIColor
This code is needed for colorised Term output. But it is fine to comment it out temporarily when you need to generate or destroy scaffolds. The method or symbol 'clear' conflicts with other gems. So this probably fixes rake:erd as well.

Unable to run the rails generator for Draper

I'm on Ruby 1.9.3 and Rails 3.0.11. I recently installed Draper(0.12.0) gem, but I'm unable to run its generators. I get the following error when I try to run the generator on the Post model :-
rails generate decorator Post
/home/mohnish/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.11/lib/active_support/whiny_nil.rb:48:in `method_missing': undefined method `config' for nil:NilClass (NoMethodError)
from /home/mohnish/.rvm/gems/ruby-1.9.3-p194/gems/draper-0.12.0/lib/draper/railtie.rb:6:in `block in <class:Railtie>'
from /home/mohnish/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.11/lib/rails/railtie.rb:189:in `call'
from /home/mohnish/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.11/lib/rails/railtie.rb:189:in `each'
from /home/mohnish/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.11/lib/rails/railtie.rb:189:in `load_generators'
from /home/mohnish/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.11/lib/rails/application.rb:147:in `block in load_generators'
from /home/mohnish/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.11/lib/rails/application/railties.rb:11:in `each'
from /home/mohnish/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.11/lib/rails/application/railties.rb:11:in `all'
from /home/mohnish/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.11/lib/rails/application.rb:147:in `load_generators'
from /home/mohnish/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.11/lib/rails/generators.rb:319:in `load_generators_from_railties!'
from /home/mohnish/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.11/lib/rails/generators.rb:278:in `lookup'
from /home/mohnish/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.11/lib/rails/generators.rb:141:in `find_by_namespace'
from /home/mohnish/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.11/lib/rails/generators.rb:161:in `invoke'
from /home/mohnish/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.11/lib/rails/commands/generate.rb:10:in `<top (required)>'
from /home/mohnish/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.11/lib/active_support/dependencies.rb:239:in `require'
from /home/mohnish/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.11/lib/active_support/dependencies.rb:239:in `block in require'
from /home/mohnish/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.11/lib/active_support/dependencies.rb:225:in `block in load_dependency'
from /home/mohnish/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.11/lib/active_support/dependencies.rb:593:in `new_constants_in'
from /home/mohnish/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.11/lib/active_support/dependencies.rb:225:in `load_dependency'
from /home/mohnish/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.11/lib/active_support/dependencies.rb:239:in `require'
from /home/mohnish/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.11/lib/rails/commands.rb:17:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Any inputs, on how can I debug this would be really helpful.
Thank you.
The Problem is this section in v0.12.0 (the one you are using) https://github.com/drapergem/draper/blob/v0.12.0/lib/draper/railtie.rb#L5-L8
When I look at the master branch they changed to code to look like: https://github.com/drapergem/draper/blob/master/lib/draper/railtie.rb#L5-L10
You should upgrade your draper gem to the latest release and see if the error still occurs.

Failing to do rails g bootstrap:install with 'twitter-bootstrap-rails'

It seems like I'm having the same issue as the person the OP for:
https://github.com/seyhunak/twitter-bootstrap-rails/issues/27
but I have not been able to fix it.
Doing a basic rails app like described in:
http://railscasts.com/episodes/328-twitter-bootstrap-basics
fails with trying to rails g bootstrap:install.
The base versions of r/r on my system are:
ruby v 1.9.2p320,
rails 3.1.0
on snow leopard 10.6.4
The way I can replicate on my local system:
rails new bsapp --skip-stylesheets
cd bsapp
rails g scaffold product name:string price:decimal --skip-stylesheets
add gem 'twitter-bootstrap-rails' to the assets group in gemfile.
bundle update
rails g bootstrap:install
This is where the problem is.
Hayk-Saakians-Mac:bsapp hayk$ rails g bootstrap:install
/Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/less-2.2.1/lib/less/java_script/v8_context.rb:61:in `rescue in lock': uninitialized constant V8::JSError (NameError)
from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/less-2.2.1/lib/less/java_script/v8_context.rb:60:in `lock'
from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/less-2.2.1/lib/less/java_script/v8_context.rb:19:in `initialize'
from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/less-2.2.1/lib/less/java_script/v8_context.rb:15:in `new'
from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/less-2.2.1/lib/less/java_script/v8_context.rb:15:in `instance'
from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/less-2.2.1/lib/less/loader.rb:10:in `initialize'
from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/less-2.2.1/lib/less.rb:14:in `new'
from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/less-2.2.1/lib/less.rb:14:in `<module:Less>'
from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/less-2.2.1/lib/less.rb:9:in `<top (required)>'
from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/less-rails-2.2.3/lib/less/rails.rb:6:in `require'
from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/less-rails-2.2.3/lib/less/rails.rb:6:in `<top (required)>'
from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/less-rails-2.2.3/lib/less-rails.rb:1:in `require'
from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/less-rails-2.2.3/lib/less-rails.rb:1:in `<top (required)>'
from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/twitter-bootstrap-rails-2.1.3/lib/twitter-bootstrap-rails.rb:9:in `require'
from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/twitter-bootstrap-rails-2.1.3/lib/twitter-bootstrap-rails.rb:9:in `<top (required)>'
from /Users/hayk/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.2.0/lib/bundler/runtime.rb:68:in `require'
from /Users/hayk/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.2.0/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from /Users/hayk/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.2.0/lib/bundler/runtime.rb:66:in `each'
from /Users/hayk/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.2.0/lib/bundler/runtime.rb:66:in `block in require'
from /Users/hayk/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.2.0/lib/bundler/runtime.rb:55:in `each'
from /Users/hayk/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.2.0/lib/bundler/runtime.rb:55:in `require'
from /Users/hayk/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.2.0/lib/bundler.rb:128:in `require'
from /Users/hayk/ror/bsapp/config/application.rb:7:in `<top (required)>'
from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.1.0/lib/rails/commands.rb:21:in `require'
from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.1.0/lib/rails/commands.rb:21:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Hayk-Saakians-Mac:bsapp hayk$
full source: http://pastebin.com/nXBcq2bB
The root of the problem was a bad/old/nonexistent installation of v8/therubyracer/libv8
Certain versions of the libv8 gem just straight up failed to install, and the ones that did -- they took several hours, so I assumed they were hanging/crashing (I am working with a netbook, so that could be expected).
At the moment, the following configuration works for me:
gem "libv8", "3.11.8.13"
gem "therubyracer", :require => 'v8'
gem "less-rails"
gem "twitter-bootstrap-rails"
in development, and in production (heroku)
There was a github issue on either rubyracer or libv8 related to this that mentioned issues with x86/32bit processors -- i don't remember it offhand.

uninitialized constant Capistrano (NameError)

rvm 1.14.5, rvm-capistrano (1.2.2) and capistrano (2.12.0)
My Gemfile is :
group :development, :test do
gem 'rvm-capistrano'
gem 'capistrano'
end
When I try to start passenger, I keep seeing this error :
[ pid=4691 thr=76294140 file=utils.rb:176 time=2012-07-04 11:37:06.179 ]: *** Exception NameError in PhusionPassenger::Rack::ApplicationSpawner (uninitialized constant Capistrano) (process 4691, thread #<Thread:0x9184ff8>):
from /home/ved/.rvm/gems/ruby-1.9.3-p194/gems/rvm-capistrano-1.2.2/lib/rvm/capistrano.rb:3:in `<top (required)>'
from /home/ved/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.1.3/lib/bundler/runtime.rb:74:in `require'
from /home/ved/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.1.3/lib/bundler/runtime.rb:74:in `rescue in block in require'
from /home/ved/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.1.3/lib/bundler/runtime.rb:62:in `block in require'
from /home/ved/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.1.3/lib/bundler/runtime.rb:55:in `each'
from /home/ved/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.1.3/lib/bundler/runtime.rb:55:in `require'
from /home/ved/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.1.3/lib/bundler.rb:119:in `require'
from /home/ved/rails_projects/grabber/config/application.rb:12:in `<top (required)>'
from /home/ved/rails_projects/grabber/config/environment.rb:3:in `require'
from /home/ved/rails_projects/grabber/config/environment.rb:3:in `<top (required)>'
from config.ru:3:in `require'
from config.ru:3:in `block in <main>'
Just taking a stab here, but make sure that you are excluding the development and test group when your bundle is installed.
bundle install --without test development
It sounds like for some reason your application is trying to load rvm-capistrano.

refinery-edge gives error "no such file to load -- refinerycms-base (LoadError)"

I'm trying to run refinery-edge on my Ubuntu 10.04 64bit. I have RVM installed, created the gemset "refinery-edge", and followed the steps in the refinery website, but when I try to create the refinery project I get the following error:
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- refinerycms-base (LoadError)
from <internal:lib/rubygems/custom_require>:29:in `require'
from /home/felixmm/Desktop/Rails_Projects/refinerycms-edge/lib/refinerycms.rb:2:in `block in <top (required)>'
from /home/felixmm/Desktop/Rails_Projects/refinerycms-edge/lib/refinerycms.rb:1:in `each'
from /home/felixmm/Desktop/Rails_Projects/refinerycms-edge/lib/refinerycms.rb:1:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from /home/felixmm/Desktop/Rails_Projects/refinerycms-edge/lib/refinery.rb:3:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from refinerycms-edge/bin/refinerycms:15:in `<main>'
Any help on this? thanks.
I've removed the guide as that was really for pre-0.9.9 and was asking for feedback via GitHub, please use the gem instead.
Currently the gem is up to date with edge.
Thanks