Rails 2.3.14 not working - ruby-on-rails

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.

Related

Rails 5: Error with spring when run devise:install

I am trying make a API with Rails
Ruby version: ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux]
Rails version: Rails 5.2.4.1
I added the devise gem to the gemfile and ran the bundle, without errors. When I tried to run $ rails generate devise: install, this error occurred:
/home/isaac/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/spring-2.1.0/lib/spring/application.rb:122:in `ensure in preload': undefined method `application' for Rails:Module (NoMethodError)
from /home/isaac/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/spring-2.1.0/lib/spring/application.rb:126:in `preload'
from /home/isaac/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/spring-2.1.0/lib/spring/application.rb:157:in `serve'
from /home/isaac/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/spring-2.1.0/lib/spring/application.rb:145:in `block in run'
from /home/isaac/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/spring-2.1.0/lib/spring/application.rb:139:in `loop'
from /home/isaac/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/spring-2.1.0/lib/spring/application.rb:139:in `run'
from /home/isaac/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/spring-2.1.0/lib/spring/application/boot.rb:19:in `<top (required)>'
from /home/isaac/.rbenv/versions/2.5.0/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
from /home/isaac/.rbenv/versions/2.5.0/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
from -e:1:in `<main>'
Try restarting the spring server by using the following commands:
bin/spring stop
bin/spring start

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

Rails capistrano deploy issue, Malformed version number string Capistrano

I'm not very familiar with ruby. I'm trying to deploy existing project to the staging server.
Project uses followings,
ruby 1.8.7
rails 2.3.5
rake 0.8.7
capistrano 2.5.13
capistrano-ext 1.2.1
When I run “cap staging deploy” in my project root, it fails with Malformed version number string Capistrano::Version (ArgumentError)
following is the console output,
/Users/sajithk/.rvm/rubies/ruby-1.8.7-head/lib/ruby/site_ruby/1.8/rubygems/version.rb:187:in `initialize': Malformed version number string Capistrano::Version (ArgumentError)
from /Users/sajithk/.rvm/gems/ruby-1.8.7-head#global/gems/bundler-1.9.1/lib/bundler/capistrano.rb:8:in `new'
from /Users/sajithk/.rvm/gems/ruby-1.8.7-head#global/gems/bundler-1.9.1/lib/bundler/capistrano.rb:8
from /Users/sajithk/.rvm/gems/ruby-1.8.7-head/gems/capistrano-2.5.13/lib/capistrano/configuration/loading.rb:152:in `require'
from /Users/sajithk/.rvm/gems/ruby-1.8.7-head/gems/capistrano-2.5.13/lib/capistrano/configuration/loading.rb:152:in `require'
from ./config/deploy.rb:1:in `load'
from /Users/sajithk/.rvm/gems/ruby-1.8.7-head/gems/capistrano-2.5.13/lib/capistrano/configuration/loading.rb:172:in `load_from_file'
from /Users/sajithk/.rvm/gems/ruby-1.8.7-head/gems/capistrano-2.5.13/lib/capistrano/configuration/loading.rb:89:in `load'
from /Users/sajithk/.rvm/gems/ruby-1.8.7-head/gems/capistrano-2.5.13/lib/capistrano/configuration/loading.rb:86:in `load'
from /Users/sajithk/.rvm/gems/ruby-1.8.7-head/gems/capistrano-2.5.13/lib/capistrano/configuration/loading.rb:86:in `each'
from /Users/sajithk/.rvm/gems/ruby-1.8.7-head/gems/capistrano-2.5.13/lib/capistrano/configuration/loading.rb:86:in `load'
from Capfile:4:in `load'
from /Users/sajithk/.rvm/gems/ruby-1.8.7-head/gems/capistrano-2.5.13/lib/capistrano/configuration/loading.rb:172:in `load_from_file'
from /Users/sajithk/.rvm/gems/ruby-1.8.7-head/gems/capistrano-2.5.13/lib/capistrano/configuration/loading.rb:89:in `load'
from /Users/sajithk/.rvm/gems/ruby-1.8.7-head/gems/capistrano-2.5.13/lib/capistrano/configuration/loading.rb:86:in `load'
from /Users/sajithk/.rvm/gems/ruby-1.8.7-head/gems/capistrano-2.5.13/lib/capistrano/configuration/loading.rb:86:in `each'
from /Users/sajithk/.rvm/gems/ruby-1.8.7-head/gems/capistrano-2.5.13/lib/capistrano/configuration/loading.rb:86:in `load'
from /Users/sajithk/.rvm/gems/ruby-1.8.7-head/gems/capistrano-2.5.13/lib/capistrano/cli/execute.rb:64:in `load_recipes'
from /Users/sajithk/.rvm/gems/ruby-1.8.7-head/gems/capistrano-2.5.13/lib/capistrano/cli/execute.rb:64:in `each'
from /Users/sajithk/.rvm/gems/ruby-1.8.7-head/gems/capistrano-2.5.13/lib/capistrano/cli/execute.rb:64:in `load_recipes'
from /Users/sajithk/.rvm/gems/ruby-1.8.7-head/gems/capistrano-2.5.13/lib/capistrano/cli/execute.rb:30:in `execute!'
from /Users/sajithk/.rvm/gems/ruby-1.8.7-head/gems/capistrano-2.5.13/lib/capistrano/cli/execute.rb:14:in `execute'
from /Users/sajithk/.rvm/gems/ruby-1.8.7-head/gems/capistrano-2.5.13/bin/cap:4
from /Users/sajithk/.rvm/gems/ruby-1.8.7-head/bin/cap:19:in `load'
from /Users/sajithk/.rvm/gems/ruby-1.8.7-head/bin/cap:19
from /Users/sajithk/.rvm/gems/ruby-1.8.7-head/bin/ruby_executable_hooks:15
I found the issue by myself. This might help someone else who came across same issue in the future.
The issue was with the bundler. I have used the latest version of bundler. Since this is a older project, I seems the bundler is not compatible with them. I downgrade the bundler to 1.0.10. everything works ok now.
Commands used,
rvm #global do gem uninstall bundler
gem install bundler -v ‘1.0.10'
Thanks

Why won't Rails' console start or make new apps?

A few days ago I updated my gems because things weren't running so fine, so I went back to 1.4.2. Since then I'm getting all kind of weird errors.
I'm using Ruby 2.0.0p247, Rails 4.0 and Ubuntu.
If I try to start a new app using rails new eraseme, everything goes fine until it's time to do bundle install. The output is:
run bundle install
/usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/generators/app_base.rb:270:in `require': cannot load such file -- bundler (LoadError)
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/generators/app_base.rb:270:in `bundle_command'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/generators/app_base.rb:277:in `run_bundle'
from (eval):1:in `run_bundle'
from /usr/local/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/command.rb:27:in `run'
from /usr/local/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/invocation.rb:120:in `invoke_command'
from /usr/local/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/invocation.rb:127:in `block in invoke_all'
from /usr/local/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/invocation.rb:127:in `each'
from /usr/local/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/invocation.rb:127:in `map'
from /usr/local/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/invocation.rb:127:in `invoke_all'
from /usr/local/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/group.rb:233:in `dispatch'
from /usr/local/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/base.rb:439:in `start'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands/application.rb:43:in `<top (required)>'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/cli.rb:15:in `require'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/cli.rb:15:in `<top (required)>'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/bin/rails:9:in `require'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/bin/rails:9:in `<top (required)>'
from /usr/local/bin/rails:23:in `load'
from /usr/local/bin/rails:23:in `<main>'
If I try to open the console, I get:
>> bundle exec rails console
Loading development environment (Rails 4.0.0)
/usr/local/lib/ruby/2.0.0/irb/locale.rb:150:in `block in search_file': undefined method `try_activate' for Gem:Module (NoMethodError)
from /usr/local/lib/ruby/2.0.0/irb/locale.rb:158:in `block in each_localized_path'
from /usr/local/lib/ruby/2.0.0/irb/locale.rb:167:in `each_sublocale'
from /usr/local/lib/ruby/2.0.0/irb/locale.rb:157:in `each_localized_path'
from /usr/local/lib/ruby/2.0.0/irb/locale.rb:145:in `search_file'
from /usr/local/lib/ruby/2.0.0/irb/locale.rb:124:in `find'
from /usr/local/lib/ruby/2.0.0/irb/locale.rb:108:in `load'
from /usr/local/lib/ruby/2.0.0/irb/locale.rb:32:in `initialize'
from /usr/local/lib/ruby/2.0.0/irb/init.rb:114:in `new'
from /usr/local/lib/ruby/2.0.0/irb/init.rb:114:in `init_config'
from /usr/local/lib/ruby/2.0.0/irb/init.rb:16:in `setup'
from /usr/local/lib/ruby/2.0.0/irb.rb:380:in `start'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands/console.rb:90:in `start'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands/console.rb:9:in `start'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:64:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Have you already installed bundler? If not, try:
gem install bundler
If so, try:
gem install bundler --pre
If you running Ruby version manager, what version are you running? You might be set to the wrong version of Ruby.
I think it would be easier for you if you used RVM or some other version manager.
if you have multiple versions of rubygems installed, uninstall all but the one you want to use.
I think rails 4 requires rubygems 2.x.
Also check the bundler version.

Bundler not working: in `[]': undefined method `[]' for false:FalseClass

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.

Resources