Rails + rubygems + rvm disaster/confusion - ruby-on-rails

I'm not sure exactly what I did but I messed up the Ruby/gem harmony trying to get an older 2.3.5 Rails app working on my system.
I'm currently using Ruby 1.9.2-p0 and rubygems 1.5.7. I've tried the newest one 1.8.2 but it just generates more warnings. I use these alongside of RVM.
I get "can't convert Symbol into Integer" when trying to boot a 2.3.x Rails app no matter what version of rubygems I run. I tried 1.5.7, 1.7.2, and 1.8.2.
$ script/server
=> Booting WEBrick
=> Rails 2.3.5 application starting on http://0.0.0.0:3000
path/.rvm/gems/ruby-1.9.2-p0/gems/rails-2.3.5/lib/rails/gem_dependency.rb:51:in `[]': can't convert Symbol into Integer (TypeError)
Any idea how I can get my system back in harmony?

As Dex and The Tin Man suggested in the comments, the solution was to run rails 2 on ruby 1.8.7 and rails 3 on ruby 1.9.2 using vrm. The warnings generated by rubygems 1.8.2 (now 1.8.3) are solved by running his suggest commands.

Related

configuring VPS for Ruby on rails app...which version of Ruby to use?

I'm configuring my first VPS for my first ruby on rails app that I´m soon deploying to the web.
I'm following this documentation https://gorails.com/deploy/ubuntu/16.04
it is going greate, but I just realised that my version of Ruby is ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin15] and the recommended for the setup is ruby version 2.3.1.
So do I have to update the ruby version on my computer to 2.3.1 or is it ok to deploy an app build on ruby 2.2.3 to an server running version 2.3.1.
This might be a stupid question, but I just want to be sure because I lack experience and I´m setting up VPS for the first time.
p.s
The App soon to deployed is built in rails 4.2.5
It is totally fine if you use Ruby 2.2.3 in this circumstance because there's not much difference between Ruby 2.2.3 and 2.3.1, they are all minor versions of Ruby 2.0.0. In addition, Rails 4.2.5 works normally with both of them.

Error using heroku_san gem: Your Ruby version is x.x.x, but your Gemfile specified x.x.x (Bundler::RubyVersionMismatch)

After upgrading a Rails application to use Ruby 2.0.0 (from 1.9.3), I started receiving this error when attempting to deploy to Heroku via rake <stage> deploy.
Your Ruby version is 1.9.3, but your Gemfile specified 2.0.0 (Bundler::RubyVersionMismatch)
It also seems to cause this error, (but I can run the Heroku commands manually without the heroku_san helpers, so authorization is not the issue).
Expected(200) <=> Actual(401 Unauthorized)
I updated the gems to the latest version, and also updated the Heroku Toolbelt.
I found this pull request and patched my version, but the error persisted.
How do I solve this (on both Ubuntu & OSX)?
Other info:
Ubuntu 12.04 LTS x64
Rails 3.2.13
Ruby 2.0.0-p247
heroku-api-0.3.15
heroku_san-4.0.8
heroku-toolbelt/2.41.0 (x86_64-linux)
rvm 1.22.10
The solution for me on Ubuntu was to modify
/usr/local/heroku/bin/heroku
And change the shebang line to
#!/usr/bin/env ruby
Thanks goes to Pivotal Labs for this.
(I don't use a Mac.)
Another issue I found with this error (1.9.2 not 1.9.3) is having BUNDLE_GEMFILE env variable set on heroku which causes heroku ruby build pack to freak and default to 1.9.2.

Rails Starting Up With Wrong Version of Ruby

TLDR: How do I force a rails app to use the correct ruby interpreter?
Hello,
Something hosed parts of my Ruby 1.9.2p290 install (certain classes just went missing one day), so I removed it and attempted to reinstall the environment.
I'm running on Snow Leopard.
Ruby 1.9.2 was installed from source. (I tried to install via MacPorts and it would fail). I am not keen on RVM as I use bundler and I seem to recall some problems with how bundler and RVM interact, though from what I can tell RVM works.
After reinstalling a few gems I noticed they were being placed in a gem folder for Ruby 1.8. "This is weird," I thought.
Starting up the rails app, I notice a lot of weird exceptions being thrown regarding syntax. After printing RUBY_VERSION to stdout, I noticed that the Rails app is running 1.8.7.
which ruby shows only one ruby interpreter:
$ which ruby
/usr/bin/ruby
$ /usr/bin/ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin10.8.0]
If I open up Activity Monitor, the ruby process from the Rails app lives at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby, which I believe is the ruby interpreter that OSX shipped with.
I haven't found any information on completely purging Ruby from OSX. I would love to do that then simply install ruby from source.
It seems there are two problems:
Rails is running a ruby interpreter that I have no idea how it is calling, when I need it to run the 1.9.2 interpreter installed from source
gems are being installed in a 1.8 folder, I suspect because gem thinks its running under 1.8
How do I fix this?
Thank you,
Tom
I guess the best way to overcome this issue is using rvm to handle your Ruby and Rails environments through 'gemset's.
I had the same issue and I use gemsets now without a problem.
This is the article which I got things working:
http://stjhimy.com/posts/10-five-quick-steps-to-set-up-rvm-with-rails-2-and-rails3

Ruby on Rails 3 Tutorial: Chapter 2 Section 2.2.1 A User Tour

I am new to Ruby on Rails and am working through this tutorial book. I am on Windows Vista and using Cygwin. Here are the versions of the software that I am running:
Ruby version 1.9.2 (i386-cygwin)
RubyGems version 1.8.10
Rack version 1.3
Rails version 3.1.0
JavaScript Runtime JScript
Active Record version 3.1.0
Action Pack version 3.1.0
Active Resource version 3.1.0
Action Mailer version 3.1.0
Active Support version 3.1.0
In the beginning of section 2.2, I was able to successfully run: ($ rails generate scaffold User name:string email:string) and ($ rake db:migrate). But when I went to run the ($ rails server) command and opened up the webpage in Chrome, I did not see the screen shown in Fig. 2.4. But instead saw this instead: "Encoding::InvalidByteSequenceError in Users#index" I saw the post about switching the rake version from 0.9.2 to 0.8.7 and I tried this, but it didn't work for me. Does anybody now of anything else that I can try? Thank you, Nick.
I've tried rails learning with Windows 7 + Cygwin and it was a real pain in the ass. I strongly recommend you to run linux on the virtual machine or make a dual-boot.
Since you are using ruby 1.9.2 you can try to add # coding: utf-8 at the beginning of Controller file

Anyone Try Running Rails 2.2 (or Edge) under Ruby 1.9.1 RC1

Ruby 1.9.1 RC1 was released today so I quickly moved to install it (a test version of course using a suffix of 19). I install Rails and Rack for the 1.9 RubyGems and then create a new Rails site using edge... when I execute:
ruby19 ./script/server
I watch as the processor usage goes up to 99.8 and the terminal just sits there. Trying to run Rails 2.2 using 1.9.1RC1 gives all sorts of fail on the inflector. I was under the impression that Rails 2.2 was 1.9.1 compatible. Is anyone successfully testing Rails under Ruby 1.9.1 or are you seeing similar errors?
The same thing for me.
I'm running the latest edge rails under webrik and just see the blank screen and no response to Ctrl-C. Rails 2.2 isn't working at all.
Also, I've tried run edge under thin (with eventmachine from github fixed to build on ruby 1.9.1, except one broken ruby test - I've just added empty one with 'assert true').
After that, both webrick and thin crashes immediately with:
$ /usr/local/bin/ruby script/server
/usr/local/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.3/lib/rubyeventmachine.bundle: [BUG] Bus Error
ruby 1.9.1 (2008-12-30 patchlevel-0 revision 21203) [i386-darwin9.6.0]
So, I guess, we all need calm down now. There still much work to actually run our rails apps under 1.9.1. Many gems are still at the early stages of bringing compatibility with 1.9.1
Actually, rails 2.2 is not fully compatible with ruby 1.9.1, just a basic compatibility, according to rails core team :)
Full compatibility claimed in upcoming rails 2.3.
I have written a guide on using Rails edge (near enough to 2.3) and Ruby 1.9.1. mysql, postgres and a few other gems like hpricot, thin and mongrel don't work, but the application does work.
Rails 2.2.2 is not compatible with Ruby 1.9.1rc1 when processing characters and strings on ActiveSupport. Rails uses multibyte to support unicode char-set, in other hand Ruby 1.9.1 uses built-in unicode support. Supported versions is 1.8.5 to 1.8.7.

Resources