#200 Rails 3 Beta and RVM
Get started with Rails 3.0 Beta and install Ruby 1.9.1 using RVM: Ruby Version Manager. Stay tuned to the end for a challenge on giving back to open source.
- Download:
- mp4Full Size H.264 Video (21 MB)
- m4vSmaller H.264 Video (11.3 MB)
- webmFull Size VP8 Video (27.3 MB)
- ogvFull Size Theora Video (25.8 MB)
We've been waiting for this one. Thank you Ryan! P.S.: What a nice episode number ;)
Episode 200 and Rails 3 falling at the same time.. coincidence? I think not!
Nice thank you again :O)
congrats with your 200th!
Keep up the good work, cheers!
Congrats Ryan on episode 200!
Keep up the good work.
Congratulations and thank you! That's all I've to say after 200 enlightening episodes.
Cheers on episode 200.
I think it would have been a scary coincidence if it were episode 300 ;-)
Keep them coming tho!!
Did I mention I love this railscast?
As a note:
rails generate scaffold game name:string
can also be shortened by calling
rails g scaffold game name:string
Gratz on the 200th episode.
Congratulations with #200 and thank you so much for all these wonderful explanations! Keep going, I love it!
Gongratz with your number 200 mate! Awesome!
Congras #200! The best site about ROR!
Happy #200 screencast! Thank you so much Ryan! Your tutorials are the best! [And thank you to Asciicasts too!]
Congratulations Ryan! Thanks for providing such a great resource for us all.
You can also segregate and use gems(ets) to install / manage your rails3 project, for example:
http://gist.github.com/296055
~Wayne
Congratulations for your AWESOME work along this 200 episodes. Thank you very much Ryan!!!
Just amazing as usual
Thanks Ryan, you are awesome!
Congratulations on episode 200 :D I've learned allot through your episodes! :) Amazing work
Thanks Ryan and well done on reaching 200! You're making a huge contribution.
I've been using RVM and I think it's a great idea to manage "Rubies" this way.
Thanks for the 'cast
Congrats Ryan on 200 episodes! Most shows never hit 100… 200 is legendary!
It is Fantastic that a Rails 3 intro is episode 200! Any thoughts about the adoption of Ruby 1.9 or updating plugins/gems for Rails 3? It seems a little stagnant… why is that?
I've set up RVM just last week because of the same reason you mentioned in your Railscast.
Congratulations for your 200th episode and thank you for all your hard work. I'll keep donating back to the open source community and am looking forward to see more Rails 3 magic in the upcoming episodes.
Thanks,
Attila
Just installed RVM and it's great. Conveniently solved my problems following installing ruby 1.9.1 onto my development machine that hosts applications I am not ready yet to migrate.
Thanks Ryan,
congrats for 200
Happy #200 episodes Ryan !
thanks for your amazing railscats, the best RoR resources ever !
Congrats on 200! I love your work, and look forward to new videos pop up in my reader.
Regarding the Window's comment in the railscast. If you would like to manage multiple versions of ruby on windows please use pik which is an excellent windows tool by Gordon Thiesfeld. You can find it on Github at
http://github.com/vertiginous/pik
~Wayne
What a coincidence !!! 200th episode comes out with rials 3. I always appreciate what you have given to the community.
Congrats on episode 200, and know that your call to give back is going beyond rails as well :)
You've helped us all out.
This is great. Thanks Ryan.
I am wondering how would I switch back or downgrade to rails 2.3.4?
Thanks.
All the junk in the stderr output in the terminal is a known issue (it's not for debugging). You can get rid of it if you follow the direction here: http://bit.ly/bNiLrS
Ryan, congratulations on episode 200! Thanks a lot for your great work. I do appreciate it!
Jeremy Kemper said:
Rails 3 will definitely prefer Ruby 1.9.2.
If you’re running 1.9, I’d recommend building 1.9.2dev rather than using 1.9.1. It’s big upgrade, it has quite a few behavior changes, and Rails master is developed against 1.9.2 exclusively (though we do continuous integration against 1.9.1 for good measure).
The key to *requiring* 1.9.2 is full mysql-ruby, pg, and sqlite3-ruby encoding support. These database drivers have had ages to upgrade but still aren’t up to snuff. Pitch in, make it happen, and you’ll find the database-backed web app world one step behind you.
@George, if you are using rvm as I show in this episode you can simply switch back to your older version of Ruby and it will use the older version of Rails.
Also specifying the rails version in your config/environment.rb (for 2.3 projects) will work so you can easily juggle multiple Rails apps with multiple versions.
@Nicholas, thanks for the link on fixing the stderr output!
@Hussein, thanks for the corrections and update! It is good to know 1.9.2 is receiving more focus.
Is it alright to use sudo before gem install/upgrade, provided I'm using the version of ruby I had prior to using rvm? Without it, it installs gems in ~/.gem.
Thank you for this nice episode, and for the forthcoming ones. Didn't know about rvm, it's a lifechanger!
Notes about rubygems:
1. You forgot the rake dependency:
gem install rake
2. you may hit upon the following error:
ERROR: Error installing bundler:
bundler requires RubyGems version >= 1.3.5
Then you can fix this with:
gem install rubygems-update
update_rubygems
gem install bundler
Everything should be fine then.
Also, related to the load of output and bundler error one may see when running rails commands inside a rails application, it's likely to be related to bundler.
There are some instructions about how to get rid of them:
http://www.ozmox.com/2010/02/07/fixing-rails-3-beta-invalid-gemspec-format-errors/
The proposed fix and some variants of it have made their ways into several bundler forks on github, so one may expect to install a new release of bundler soon I guess :)
To install on OSX, this is missing two bugfix things you need to do. If you don't, you'll get an error like:
<pre>readline.c:703: error: 'filename_completion_function' undeclared (first use in this function)</pre>
1. instead of rvm install 1.8.7 or 1.9.1, run:
CPPFLAGS="-DHAVE_RL_FILENAME_COMPLETION_FUNCTION -DHAVE_RL_USERNAME_COMPLETION_FUNCTION -DHAVE_RL_COMPLETION_MATCHES" rvm install 1.8.7
(or 1.9.1 or whatever)
2. after you run <pre>rvm 1.8.7</pre> and before you go to install the rails beta gem, run:
gem sources -r http://gems.rubyonrails.org
... for whatever reason, their gemserver is really old and not compatible. It's on github anyway.
Ryan, you can use "git clone --depth=1" unless full git history log is needed
Thank you for this new awesome cast ryan !
But maybe you could help me with my problem :
I installed rvm, ruby-19.1 and all rubygems (tzinfo builder memcache-client rack rack-test rack-mount erubis mail text-format thor bundler i18n) without any trouble.
But when I want to install rails 3 I got this issue below.
I'm using this command :
gem install rails --pre --debug -r --http-proxy http://127.0.0.1:9666
(I'm using a proxy because i'm living in China and I cannot access directly to http://gems.rubyforge.org/ from few months. So usually when I install a new gem, i use a proxy or I download directly the gem from the web)
the trace :
Exception `Gem::Package::FormatError' at /home/Acer-fredo/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/site_ruby/1.9.1/rubygems/package/tar_input.rb:110 - No metadata found!
Exception `Gem::InstallError' at /home/Acer-fredo/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:121 - invalid gem format for /home/Acer-fredo/.rvm/gems/ruby-1.9.1-p378/cache/activesupport-3.0.0.beta.gem
ERROR: Error installing rails:
invalid gem format for /home/Acer-fredo/.rvm/gems/ruby-1.9.1-p378/cache/activesupport-3.0.0.beta.gem
Probably it comes from my proxy problem, but i'm not sure.
Do you have an idea or do you know where I can directly download rails-3.0.0 gems ?
Thanks.
Thank you Ryan.
Congrats for the #200. Thank you Ryan for your screencasts :)
#200, yey! Ryan, I think you should give some badges, images or buttons, etc, so more people help you promote the "Give back to open source" campaign in their sites!
@Doug, it depends on how your system Ruby is set up, but most likely you will want to use "sudo" with that, yes.
@jdv, rvm updated rubygems and rake for me when I did the install which is why I did not cover that here. I'm guessing this is a recent change.
@fred, you can clone Rails 3 directly from GitHub instead of installing as a gem. I'm not sure how to fix the proxy error, sorry.
@Gustavo, thanks for the suggestion. Feel free to grab the ribbon and badge I use on this site.
If anyone has any hang-ups with rack-mount, this is my experience:
gem install rack-mount now installs version 0.5.0 instead of 0.4.5... not sure why that should be a problem, but when i tried to install rails --pre, i got this:
ERROR: Error installing rails:
actionpack requires rack-mount (~> 0.4.0, runtime)
I don't think rvm contributed to these problems, but i got this error after installing 1.8.7-p248 with rvm (I had installed p249 but that gave some errors when trying to install any version of Rails, so I reverted to p248 after reading that had fixed someone's problems with Rails 3). Now I still get segfaults for gem installs sometimes, then they work for no apparent reason the next time I try. That seems to be a minor issue with rvm that I can live with.
I noticed that this screencast worked with rack-mount 0.4.5. So, after uninstalling rack-mount, I tried:
gem install rack-mount --version=0.4.5
This worked the second time (after a segfault the first time).
Then I tried once more:
gem install rails --pre
And after waiting a few minutes with nothing happening...
7 gems installed
rails -v
Rails 3.0.0.beta
@fred zingg
For what it's worth, I'm in China too and have no problem accessing ruby gems from the command line without a proxy. Youtube, Vimeo, and Danwei, on the other hand...
For those wondering about Ruby 1.9.1 vs 1.9.2. Rails 3 does support Ruby 1.9.1 but recommends 1.9.2. Since the latter is not yet released and I had some difficulties with it, I am showing 1.9.1 here.
@steve, right, I ran into the rack-mount dependency issue this morning as well. It will be fixed soon by a new release of Rails 3 beta gem.
happy 200! :)
@steve, thank you for this info, I was pretty sure the china's great firewall do not block gems.rubyforge.org, but the fact is I only cannot access this one. In my browser I cannot open http://gems.rubyforge.org/yaml if I don't use a proxy. No problem with others gem website.
@bryan, thank you for the github link. But I still I have a problem :
I downloaded sources then build and install every packages (actionpack, activerecord, etc...), then rails rails-3.0.0.beta1. Everything seems ok, but when I run my app with rails server, it says it cannot find rails sources in gems dir. And after checking I cannot find sources in rails-3.0.0.beta1 gem dir. So maybe I did something wrong during installation.
Another question, what's the best place at the moment to talk about rails 3 install problem ?
Great job Ryan!
Thnx for the Tutorial Ryan!
I have a small problem when I try to use postgresql...
I always get the following error when trying to start my server:
gem install activerecord-postgresql-adapter
But this gem doesn't exist and I installed the pg gem...
Do you know what could be the problem?
Thanx!
What do you have in your gem sources?
I was missing:
gem sources --add http://gemcutter.org
@Jelle Vandebeeck & Nicolas Marchildon
Just require the gem in your Gemfile and sources should be handled at the same time. No need to let Rubygems handle the source =)
Hi!
Excelent work Ryan!
Congratulations for the 200th episode
Currently, `gem install rails --pre` doesn't work as it cannot pull non-pre dependencies. There is a gem called 'rails3b' which you can gem install to get around this.
@fred zingg: For real-time help i'd suggest using irc (freenode.net, #rubyonrails) - not knowing if irc-access to freenode is "censured". But have a look at http://rubyonrails.org/community
Thanks for yet another great episode Ryan! Congrats on #200!!!
For anyone who is installing on Ubuntu 9.10, (and using 1.9.1, per the video) you might have to do what I did to get things going:
after you install rvm, but before doing anything else, do
rvm openssl
This might require other packages (like curl), so go get those. If you don't do this, everything in the install of rails 3.0.0beta will seem to be fine until you go to test your app, and the server will get errors about openssl being missing. (I also had to install sqlite3-ruby, but that's likely because I don't have it installed by default in my non rvm world). I think building ruby and possibly rails looks for the presence of openssl, and builds accordingly, so if you don't ensure it's installed before getting ruby 1.9.1, you will have to start over from scratch by removing the .rvm directory and following the video instructions from the beginning.
Some of the issues I've seen using rvm and ruby 1.9.2 on Mac OSX 10.5.8 - the first is a permissions issue where the .gem/cache directory has system and not <USER> (whoever you log in as) as the owner - chown /R .gem <USER>:staff .gem did the trick for me.
Second issue is a big crash in using 1.9.2-preview which is the default 1.9.2 install in rvm - doing rvm install ruby-1.9.2-head is reported to fix this: see https://rails.lighthouseapp.com/projects/8994/tickets/3669-ruby-192-and-rails-30pre-aborts-on-scriptgenerate
Sorry - type above: chown /R <USER>:staff .gem
Belated congratulations!
I only wish all screencasts were as well made. :-)
THANK YOU!!!
Anybody getting "warning: already initialized …" messages while running some commands will want to take a look at http://github.com/carlhuda/bundler/issues/issue/51/ - but basically the fix is just to do "rvm implode" and reinstall RVM from GitHub.
Hi Ryan,
Congrats on 200 episodes.
I am trying to follow the Railscast on WinXP, with a fresh install of 1.9.1 and rails 3 beta.
When I try to start the server with "rails server" in the root directory of the topscore app I get:
C:/Ruby19/lib/ruby/gems/1.9.1/gems/railties-3.0.0.beta/bin/rails:2: command not found: C:/topscore/script/rails
C:/Ruby19/lib/ruby/gems/1.9.1/gems/railties-3.0.0.beta/bin/rails:2:in `exec': No such file or directory - C:/topscore/script/rails (Errno::ENOENT) from C:/Ruby19/lib/ruby/gems/1.9.1/gems/railties-3.0.0.beta/bin/rails:2:
in `<top (required)>'
from C:/Ruby19/bin/rails:19:in `load'
from C:/Ruby19/bin/rails:19:in `<main>'
I think this is saying that the 'rails' script in the topscore/scripts directory cannot be found, the file does exist. Although it has no file extention.
Any one got any idea why it's not working?
I can't get gems to update on ruby 1.3.7 or 1.9.1 - I always get this error:
ERROR: While executing gem ... (Errno::EEXIST)
File exists - C:
Can't find anything online to fix it.
oh and I'm on windows 7 x64
In case someone else has the same problem - I can get away with installing gems in radrails
Very efficient presenrtation; gawds you are getting extremely good at this! I especially like how you gently identify mainline command differences w/ Rails 2. Your appeal for give-back is well done.
I made a little (little) tutorial to get ruby-debug run on the last version of ruby
Enjoy
http://thibaut-assus.heroku.com/2010/03/18/rdebug/
@Steve Byrne: i had to use the following to install openssl lib on ubuntu:
rvm package install openssl
... seems this routine is outdated - spent a day in silent sweat only to relize that ruby 1.9.2 is where the music plays. An update would have been nice.
got as far as needing "rvm package install openssl" for Ubuntu and tried again. No luck. Can make the Rails3b game model but localhost:3000 shows nothing under localhost:3000/games/new or anything else with webrick spouting a ton of errors. Also fails with thin start (my preference).
localhost:3000 shows up, but the link only shows a horizontal yellow line and not all the gems being used.
any ideas?
Hello Ryan,
Thanks for all the episodes. They have greatly helped me in trying to migrate a legacy Oracle / Developer 6i n tier enterprise application to RoR.
I am still in the early stages of the migration, having completed authentication and main menu.
My idea is to migrate the application with minimal or no change to the database structure (over which, of course I don't have any control).
Would be glad to share my progress if you could tell me where post ?
Regards.
Ramesh
For Rails 3 beta4 you need to use command
rails new topscore
to create a new rails project.
My bad, actually you only need to use the rails new [APP_NAME] style when you're inside an existing rails app directory structure. Otherwise the old style without "new" works.
Great Railscast. I followed the instructions and installed RVM and Ruby 1.9.1 and followed the rest of the instructions.
I created a new rails project called topscore
I installed: gem install sqlite3-ruby
when i try rails server i always get this error
sqlite3-ruby-1.3.1 is cached, but not installed.
Try running `bundle install`.
and i get an error when installing the sqlite3-ruby gem
this also happens on ruby v 1.9.2
any clues?
thx!
SOLVED.
Do not try to do this on a Mac unless you are on OSX 10.6.x I tried RVM and rails on 10.5 and had major headaches.
rvm seems to be the future of ruby binary version management. Not sure about the windows users...
Hey guys
I didn't see this specific issue discussed in the comments but I wanted to see if anyone may have experienced what I have.
I get Ruby1.9.2 and Rails 3 installed in separate gemsets and everything goes as expected. But when I run the Webrick server for some reason it segfaults. In the error message the version of Rails is 1.8.7 which is the version I'm running on my system. I also have a dual environment setup under RVM but I suppose since all my versions read correctly at the commandline when running ruby -v, and rails -v. It just seems to be grabbing the wrong Webrick server when running for some odd reason. By the way I'm running Ubuntu 10.04. Again mysetup is Ruby 1.8.7 on my system, then a dual configuration ran under RVM. My understanding from the RVM site is that is the recommended configuration. I tryed the IRC but I think it is saying Wayne is on vacation.
Thanks
AR,
If you're still getting "{gem_name} is cached, but not installed" errors, the first thing you'd want to try is removing the .bundle and vendor directories.
Good luck!
One problem with RVM is that it assumes that you use BASH as your default shell :(
/usr/local/lib/rvm should figure out what the current user's default shell is (via /etc/passwd) and then emit appropriate code for whatever shell that is - e.g. tcsh, csh, or bash, sh
In your video you state "Do NOT use sudo when using RVM." Yet, it is absolutely the ONLY way I can even get this to work. Otherwise I get a permission's error. Why would you not use sudo with RVM?
I am getting following permission error
ERROR: While executing gem ... (Errno::EACCES)
Permission denied - /home/rahul/.gem/specs
while running an command(Installing rails3)
gem install tzinfo builder memcache-client rack rack-test rack-mount erubis mail text-format thor bundler i18n
Some of the my observations are
rahul@LinuxGuru:~$ rvm list
rvm rubies
=> ruby-1.9.1-p378 [ x86_64 ]
rahul@LinuxGuru:~$ ruby -v
ruby 1.9.1p378 (2010-01-10 revision 26273) [x86_64-linux]
rahul@LinuxGuru:~$ which ruby
/home/rahul/.rvm/rubies/ruby-1.9.1-p378/bin/ruby
rahul@LinuxGuru:~$ which gem
/home/rahul/.rvm/rubies/ruby-1.9.1-p378/bin/gem
Sorry I got the problem,
Since owner .gem folder is root.
I changed it from root to normal user using chown, and it is working fine.
I am on os x - 10.6.4
I followed this post as closely as possible (even tried a few suggestions in the comments) yet I get the following error:
$ rails topscore
/usr/local/bin/rails: line 9: require: command not found
/usr/local/bin/rails: line 11: version: command not found
/usr/local/bin/rails: line 13: syntax error near unexpected token `('
/usr/local/bin/rails: line 13: `if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then'
$
Any ideas out there?
http://railscasts.com/episodes/200-rails-3-beta-and-rvm
big big thanks from Beijing China
If you would rather not use rvm or rbenv here's a link on how to build ruby from source:
https://github.com/yerv000/how_to-ruby_from_source