Bundler not working: in `[]': undefined method `[]' for false:FalseClass - ruby-on-rails

I'm having some troubles with my Rails app after installing (and removing) Compass. bundle install gives me the following:
/Users/[..]/.rvm/gems/ruby-1.9.2-head#rails3beta/gems/bundler 1.0.0.beta.2/lib/bundler/settings.rb:10:in `[]': undefined method `[]' for false:FalseClass (NoMethodError)
from /Users/[..]/.rvm/gems/ruby-1.9.2-head#rails3beta/gems/bundler-1.0.0.beta.2/lib/bundler/settings.rb:32:in `without'
from /Users/[..]/.rvm/gems/ruby-1.9.2-head#rails3beta/gems/bundler-1.0.0.beta.2/lib/bundler/settings.rb:26:in `without='
from /Users/[..]/.rvm/gems/ruby-1.9.2-head#rails3beta/gems/bundler-1.0.0.beta.2/lib/bundler/cli.rb:105:in `install'
from /Users/[..]/.rvm/gems/ruby-1.9.2-head#rails3beta/gems/bundler-1.0.0.beta.2/lib/bundler/vendor/thor/task.rb:33:in `run'
from /Users/[..]/.rvm/gems/ruby-1.9.2-head#rails3beta/gems/bundler-1.0.0.beta.2/lib/bundler/vendor/thor/invocation.rb:109:in `block in invoke'
from /Users/[..]/.rvm/gems/ruby-1.9.2-head#rails3beta/gems/bundler-1.0.0.beta.2/lib/bundler/vendor/thor/invocation.rb:116:in `call'
from /Users/[..]/.rvm/gems/ruby-1.9.2-head#rails3beta/gems/bundler-1.0.0.beta.2/lib/bundler/vendor/thor/invocation.rb:116:in `invoke'
from /Users/[..]/.rvm/gems/ruby-1.9.2-head#rails3beta/gems/bundler-1.0.0.beta.2/lib/bundler/vendor/thor.rb:159:in `block in start'
from /Users/[..]/.rvm/gems/ruby-1.9.2-head#rails3beta/gems/bundler-1.0.0.beta.2/lib/bundler/vendor/thor/base.rb:378:in `start'
from /Users/[..]/.rvm/gems/ruby-1.9.2-head#rails3beta/gems/bundler-1.0.0.beta.2/lib/bundler/vendor/thor.rb:138:in `start'
from /Users/[..]/.rvm/gems/ruby-1.9.2-head#rails3beta/gems/bundler-1.0.0.beta.2/bin/bundle:13:in `<top (required)>'
from /Users/[..]/.rvm/gems/ruby-1.9.2-head#rails3beta/bin/bundle:19:in `load'
from /Users/[..]/.rvm/gems/ruby-1.9.2-head#rails3beta/bin/bundle:19:in `<main>'
I've tried cleaning out the gemset and re-installing Bundler and other gems without luck. I've also tried creating a new app - bundler works fine here, so I guess the problem is somewhere withint my app code, but I have no idea where to look.
Any ideas? :-) Thanks guys.

For others with this issue, I needed to delete an empty ~/.bundler/config file I was messing with.

first look in the Gemfile for, then check for .bundle/ and vendor/cache/, remove them and launch this:
bundle package
this should resolve.

Related

How do i fix in ruby on rails the undefined method `alias_method_chain' error?

I have just cloned a github repo https://github.com/maxitron93/p2pcollective.com, as i was exploring this awesome p2p lending app i encountered an error
NoMethodError: undefined method `alias_method_chain' for ActiveRecord::ConnectionAdapters::PostgreSQLColumn:Class
both when migrationg db or raunning server. I'm using the cloud9 ide to avoid my pc environment.
Running through a couple of solution posts, i updated my gem store with device and erubis but still returned back to that 'alias_method_chain' error.
Here's a snippet of my logs:
rake db:migrate
rake aborted!
NoMethodError: undefined method `alias_method_chain' for ActiveRecord::ConnectionAdapters::PostgreSQLColumn:Class
Did you mean? alias_method
/usr/local/rvm/gems/ruby-2.3.4/gems/activerecord-postgres-hstore-0.7.8/lib/activerecord-postgres-hstore/activerecord.rb:80:in `<class:PostgreSQLColumn>'
/usr/local/rvm/gems/ruby-2.3.4/gems/activerecord-postgres-hstore-0.7.8/lib/activerecord-postgres-hstore/activerecord.rb:74:in `<module:ConnectionAdapters>'
/usr/local/rvm/gems/ruby-2.3.4/gems/activerecord-postgres-hstore-0.7.8/lib/activerecord-postgres-hstore/activerecord.rb:70:in `<module:ActiveRecord>'
/usr/local/rvm/gems/ruby-2.3.4/gems/activerecord-postgres-hstore-0.7.8/lib/activerecord-postgres-hstore/activerecord.rb:2:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require'
/usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `block in require'
/usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:256:in `block in load_dependency'
/usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:662:in `new_constants_in'
/usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:256:in `load_dependency'
/usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require'
/usr/local/rvm/gems/ruby-2.3.4/gems/activerecord-postgres-hstore-0.7.8/lib/activerecord-postgres-hstore/railties.rb:18:in `block (2 levels) in <class:Hstore>'
/usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-5.1.6/lib/active_support/lazy_load_hooks.rb:69:in `instance_eval'
/usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-5.1.6/lib/active_support/lazy_load_hooks.rb:69:in `block in execute_hook'
/usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-5.1.6/lib/active_support/lazy_load_hooks.rb:60:in `with_execution_control'
I expect my rails server to run smoothly from here.
alias_method_chain was deprecated and removed in Rails 5, but existed prior to that. It looks like a dependency (possibly pg) that has been installed is incompatible. You may be able to resolve the issue with bundle update pg, and if not, a broader bundle update should do the trick.
EDIT:
This is what I get for internet'ing before coffee. The gem responsible is in your stacktrace: activerecord-postgres-hstore, which isn't in the project you linked to, which suggests you've made other changes. You don't need that gem for Rails 4+. More info here
In my case, I had gem 'foreigner package from Gemfile
gem uninstall foreigner
bundle install
rails db:migrate
I hope it will be helpfull

undefined method 'load_defaults' with Rails Generate

I'm really new to Ruby and its Rails framework and I was following a tutorial when I ran into some issues using the rails generate command. I tried using rails generate scaffold and rails generate controller but it didn't work. The full trace is this:
/usr/lib/ruby/vendor_ruby/rails/railtie/configuration.rb:95:in `method_missing': undefined method `load_defaults' for #<Rails::Application::Configuration:0x000055cdba53c180> (NoMethodError)
from /home/eric/Projects/blog/config/application.rb:12:in `<class:Application>'
from /home/eric/Projects/blog/config/application.rb:10:in `<module:Blog>'
from /home/eric/Projects/blog/config/application.rb:9:in `<top (required)>'
from /var/lib/gems/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:92:in `require'
from /var/lib/gems/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:92:in `preload'
from /var/lib/gems/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:153:in `serve'
from /var/lib/gems/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:141:in `block in run'
from /var/lib/gems/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:135:in `loop'
from /var/lib/gems/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:135:in `run'
from /var/lib/gems/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>'
I think that the main issue is that I'm missing the 'load_defaults' method, but I couldn't find anything on how to resolve the issue. For context, I'm doing this all on a completely new rails project on Ubuntu - the only things I've done so far are rails new and bundle install.
Somewhat curiously, this issue is only popping up on new rails projects that I've created. I tried using rails generate commands on a project I had earlier and it worked. I couldn't figure out what was different between the projects though.
Any suggestions would be greatly appreciated!

undefined local variable or method `count_notification' for #Spec::Runner::TeamcityFormatter

Upgraded to latest rubymine 6.3 and while trying to run all the specs using spec configuration coming across the issue. Looking at the logs looks like a rubymine issue. Any idea how to fix this issue?
/Applications/RubyMine.app/rb/testing/patch/bdd/teamcity/spec/runner/formatter/teamcity/rspec3_formatter.rb:250:in `dump_summary': undefined local variable or method `count_notification' for #<Spec::Runner::Formatter::TeamcityFormatter:0x007f8d338fd3e8> (NameError)
from /Users/xxxxx/.rvm/gems/ruby-2.1.3/gems/rspec-core-3.1.7/lib/rspec/core/reporter.rb:134:in `block in notify'
from /Users/xxxxx/.rvm/gems/ruby-2.1.3/gems/rspec-core-3.1.7/lib/rspec/core/reporter.rb:133:in `each'
from /Users/xxxxx/.rvm/gems/ruby-2.1.3/gems/rspec-core-3.1.7/lib/rspec/core/reporter.rb:133:in `notify'
from /Users/xxxxx/.rvm/gems/ruby-2.1.3/gems/rspec-core-3.1.7/lib/rspec/core/reporter.rb:116:in `finish'
from /Users/xxxxx/.rvm/gems/ruby-2.1.3/gems/rspec-core-3.1.7/lib/rspec/core/reporter.rb:55:in `ensure in report'
from /Users/xxxxx/.rvm/gems/ruby-2.1.3/gems/rspec-core-3.1.7/lib/rspec/core/reporter.rb:55:in `report'
from /Users/xxxxx/.rvm/gems/ruby-2.1.3/gems/rspec-core-3.1.7/lib/rspec/core/runner.rb:107:in `run_specs'
from /Users/xxxxx/.rvm/gems/ruby-2.1.3/gems/rspec-core-3.1.7/lib/rspec/core/runner.rb:85:in `run'
from /Users/xxxxx/.rvm/gems/ruby-2.1.3/gems/rspec-core-3.1.7/lib/rspec/core/runner.rb:69:in `run'
from /Users/xxxxx/.rvm/gems/ruby-2.1.3/gems/rspec-core-3.1.7/lib/rspec/core/runner.rb:37:in `invoke'
from /Users/ac027466/.rvm/gems/ruby-2.1.3/gems/rspec-core-3.1.7/exe/rspec:4:in `<main>'
/Users/xxxxx/.rvm/rubies/ruby-2.1.3/bin/ruby -I/Users/xxxxx/.rvm/gems/ruby-2.1.3/gems/rspec-core-3.1.7/lib:/Users/xxxxx/.rvm/gems/ruby-2.1.3/gems/rspec-support-3.1.2/lib /Users/xxxxx/.rvm/gems/ruby-2.1.3/gems/rspec-core-3.1.7/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb failed
Updating to rubymine 6.3.3 fixed the issue for me.

Rails 2.3.14 not working

I have an existing app that runs on Rails 2.3.14. I'm setting up my environment with RVM to use Ruby 1.8.7-p374, and I installed Rails 2.3.14, and it seems as if my install isn't working.
I'm trying to verify my install of Rails by running rails -v, however running that command yields this:
/Users/jason/.rvm/gems/ruby-1.8.7-p374#global/gems/rubygems-bundler-1.4.2/lib/rubygems-bundler/noexec.rb:75:in `setup': undefined method `name' for #<Array:0x104f28960> (NoMethodError)
from /Users/jason/.rvm/rubies/ruby-1.8.7-p374/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `map'
from /Users/jason/.rvm/gems/ruby-1.8.7-p374#global/gems/rubygems-bundler-1.4.2/lib/rubygems-bundler/noexec.rb:75:in `each'
from /Users/jason/.rvm/gems/ruby-1.8.7-p374#global/gems/rubygems-bundler-1.4.2/lib/rubygems-bundler/noexec.rb:75:in `map'
from /Users/jason/.rvm/gems/ruby-1.8.7-p374#global/gems/rubygems-bundler-1.4.2/lib/rubygems-bundler/noexec.rb:75:in `setup'
from /Users/jason/.rvm/gems/ruby-1.8.7-p374#global/gems/rubygems-bundler-1.4.2/lib/rubygems-bundler/noexec.rb:114:in `check'
from /Users/jason/.rvm/gems/ruby-1.8.7-p374#global/gems/rubygems-bundler-1.4.2/lib/rubygems-bundler/noexec.rb:121
from /Users/jason/.rvm/rubies/ruby-1.8.7-p374/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:58:in `gem_original_require'
from /Users/jason/.rvm/rubies/ruby-1.8.7-p374/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:58:in `require'
from /Users/jason/.rvm/gems/ruby-1.8.7-p374#global/gems/rubygems-bundler-1.4.2/lib/rubygems_executable_plugin.rb:4
from /Users/jason/.rvm/gems/ruby-1.8.7-p374#global/gems/executable-hooks-1.2.6/lib/executable-hooks/hooks.rb:50:in `call'
from /Users/jason/.rvm/gems/ruby-1.8.7-p374#global/gems/executable-hooks-1.2.6/lib/executable-hooks/hooks.rb:50:in `run'
from /Users/jason/.rvm/gems/ruby-1.8.7-p374#global/gems/executable-hooks-1.2.6/lib/executable-hooks/hooks.rb:49:in `each'
from /Users/jason/.rvm/gems/ruby-1.8.7-p374#global/gems/executable-hooks-1.2.6/lib/executable-hooks/hooks.rb:49:in `run'
from /Users/jason/.rvm/gems/ruby-1.8.7-p374#leaselabs/bin/ruby_executable_hooks:10
I have resovled this.
method:rvm #global do gem uninstall bundler.

NoMethodError on Rails Vulcanize with Rubber

I am very new to rails and am trying to get my app setup via rubber. I was able to get a test app up without issue but am running into some sort of error when actually trying to vulcanize my built app. Tried to search high and low to no avail. Anyone have any idea what I need to do to get rid of the issue? Much appreciated.
localhost:thiswins markhayden$ rubber vulcanize complete_passenger_nginx_mysql
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/rubber-2.2.4/lib/rubber/commands/vulcanize.rb:53:in `block in <class:Vulcanize>': undefined method `-' for "complete_passenger_nginx_mysql":String (NoMethodError)
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/clamp-0.6.0/lib/clamp/attribute/declaration.rb:33:in `instance_exec'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/clamp-0.6.0/lib/clamp/attribute/declaration.rb:33:in `block in define_writer_for'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/clamp-0.6.0/lib/clamp/parameter/parsing.rb:13:in `block (2 levels) in parse_parameters'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/clamp-0.6.0/lib/clamp/parameter/parsing.rb:12:in `each'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/clamp-0.6.0/lib/clamp/parameter/parsing.rb:12:in `block in parse_parameters'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/clamp-0.6.0/lib/clamp/parameter/parsing.rb:10:in `each'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/clamp-0.6.0/lib/clamp/parameter/parsing.rb:10:in `parse_parameters'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/clamp-0.6.0/lib/clamp/command.rb:55:in `parse'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/clamp-0.6.0/lib/clamp/command.rb:68:in `run'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/clamp-0.6.0/lib/clamp/subcommand/execution.rb:11:in `execute'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/clamp-0.6.0/lib/clamp/command.rb:69:in `run'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/clamp-0.6.0/lib/clamp/command.rb:127:in `run'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/rubber-2.2.4/bin/rubber:17:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.3-p392/bin/rubber:19:in `load'
from /usr/local/rvm/gems/ruby-1.9.3-p392/bin/rubber:19:in `<main>'
from /usr/local/rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:14:in `eval'
from /usr/local/rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:14:in `<main>'
We had this same problem with:
rubber vulcanize complete_passenger_postgresql
It seems to be an error in the gem at rubber/commands/vulcanize.rb on Line 53 because it tries to subtract an array from a string which is illegal. I changed it to (as sudo):
invalid = (arg.kind_of?(String) ? [arg] : arg) - VulcanizeThor.valid_templates
This allowed setup however I am not sure if the vulcanization did more than it was supposed to have because I am also new to Rubber. This was a drastic measure so be careful by trying it on a non-production environment first!

Resources