Unable to update rails version even by using gem update rails command - ruby-on-rails

I am trying to build ROR application for which I wrote rails fist_app command in terminal. I didn't find gemfile in folder fist_app. When goggled, found Stackoverflow answer for this problem which suggest to update rails.
But when I update rails version it shows nothing to update. Here is a screen-shot.
Please suggest some solution for this problem. Thanks

You have rails installed as Ubuntu package, not as a gem, so you can't update it. Uninstall the rails package (sudo apt-get remove rails) and then install it again as a gem: gem install rails.
UPDATE: I'm not 100% sure it will work though, because gem is also installed as Ubuntu package. It's better to set up everything (ruby, gem and rails) through RVM. Here's a tutorial: http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you/

Related

update to rails 3 on ubuntu

Hopefully this is an easy one - I'm trying to install rails on my netbook. I can#'t seem to get it to update to rails 3 (seems stuck on 2.3.5). Here's some terminal output to show you what I mean...
mike#Ubuntu-Netbook:~$ rails -v
Rails 2.3.5
mike#Ubuntu-Netbook:~$ gem update rails
Updating installed gems
Nothing to update
mike#Ubuntu-Netbook:~$ sudo gem install rails
[sudo] password for mike:
Successfully installed rails-3.1.0
1 gem installed
Installing ri documentation for rails-3.1.0...
file 'lib' not found
Installing RDoc documentation for rails-3.1.0...
file 'lib' not found
mike#Ubuntu-Netbook:~$ rails -v
Rails 2.3.5
See? Stuck at 2.3.5! I have done a whole bunch of rails installs on other machines and never had this problem before - what am I missing?
The 2.3.5 install is completely working.
EDIT: I did not get an answer to this question. I got around it by investigating rvm and installing that way instead.
Are you using bundler? Are you in an rvm gemset?
If you're using the latter, once you sudo, you're in a different user's rvm install, so installation won't be the same. If you're using bundler and have locked rails to 2.3.5, that's what it'll be regardless whether you run gem update or not.
If you can answer the above two questions, we can probably narrow down your issue.

Installing Rails 2.3.4

I am working on a project that requires me to install Rails 2.3.4. I have only worked with Rails 3 applications, where I installed Rails 3 using RVM.
Since I am using a separate machine for this project, basically all I am asking for is how to install Rails 2.3.4. Any links would be much appreciated :)
did you try
sudo gem install rails -v=2.3.4
RVM http://beginrescueend.com/rvm/install/ is your best bet.
Which OS are you working with ?
The installation guide is for Linux. I don't have much experience with RVM on windows. But should be straightforward.
With RVM you get create gemsets which will give you advantage that you can run different rails version for different applications.
http://beginrescueend.com/gemsets/
gem install rails -v 2.3.4
gem install --help for more information.
There is no reason why the above can not be executed via rvm.
gem install -v=2.3.4 rails
or
sudo gem install -v=2.3.4 rails
It will install rails 2.3.4 version.

How to install AuthLogic plugin for rails 2.3.5?

I am following a Ruby on Rails tutorial in a book that uses Acts As Authenticated, but this seems to no longer be supported. I was searching and came across a SO post which recommends a couple of different alternatives for doing user authentication in rails applications. I think AuthLogic looks like a good choice. I am using Rails 2.3.5 and Ruby 1.8.7.
The AuthLogic readme section states the following:
** Please note the latest version is compatible with rails 3 only. Rails 2
should use version 2.X.X **
However, when scrolling down to the section about installing as gem or plugin, it only gives the following examples:
Rails 3:
$ sudo gem install authlogic
Rails 2:
$ sudo gem install authlogic
--version=2.1.6
Or install as a plugin:
script/plugin install
git://github.com/binarylogic/authlogic.git
I want to install a plugin, rather than the gem, but I need to do it for 2.3.5, not for 3. Can I install the plugin by version in the same way that it shows how to install the gem by version? For example:
script/plugin install git://github.com/binarylogic/authlogic.git --version=2.3.5
If this is not how it is done, could someone please explain to me how to do it?
Thanks!
I really would reconsider using as a plugin and instead setup bundler in your project. Your Gemfile line would be gem 'authlogic', '2.1.6'. If you are concerned about packaging libraries with your project you can bundle pack to include your gems with your project.
Anyway, The following plugin install command should work.
script/plugin install git://github.com/binarylogic/authlogic.git -r 'tag v2.1.6'
Installing rails 2.3.5
Create the gemset:rvm gemset create rails2
2.Setting up rvm to use always this gemset:rvm use 1.8.7#rails2 –default
Gem install rails -v 2.3.5

Rails 2.3.8 problem

I am running Ruby 1.9.1 & rails 2.3.8. Everything is installed fine as far as I can tell but when I run rake db:migrate I get this error:
Missing the Rails 2.3.8 gem. Please gem install -v=2.3.8 rails, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.
So I wanted to make sure I had rails installed and ran from the command line rails -v & it says Rails 2.3.8. So I am not sure what gives here. Can anyone point me in the right direction? thank you very much.
Well, if you really have those versions installed and you get the error, something may be wrong.
But, you can do as the message recommends and comment out the setting in your config/environment.rb so it tries to use whatever version you have installed.
Did you install rails with a different package manager? If I install rails with "sudo apt-get install rails" then "rails -v" uses the rails binary in /bin (even if it's 2.3.5 or 2.0.2) because that is first in my path. If after that I install rails with "sudo gem install rails -v=2.3.8" typing "rails -v" still gives me the version of the /bin rails. I haven't verified, but I would guess this is the same issue if you're using macports. If you uninstall the package you installed with the non rubygems package manger and then reinstall rails with rubygems that may fix your issue.
Hope this helps.

Ruby on Rails Beta 3 Install on Snow Leopard - file not found

I tried to install the new beta on my system with the command:
sudo gem install rails --pre
but no matter what I tried, I still get this damn error:
Successfully installed
rails-3.0.0.beta3 1 gem
installed Installing ri
documentation for
rails-3.0.0.beta3... File not
found: lib
Since I'm very new to ruby, I really don't know what to do.
How can I finish installing this?
Is this installed already?
Why does it abort here?
All you need to run is gem install rdoc, follow its instructions, then run the install rails command again and you're good. The problem is due to rdoc failing to install when installed with rails, if installed manually it works fine.
Source: http://gist.github.com/565967
^ I had the same problem, and this worked for me.
If you're looking to do ruby/rails development on Mac, I'd strongly recommend not using the version of ruby/rubygems shipped with your mac. What I do recommend is:
Installing homebrew and using that to manage software packages on your mac.
Install brewbygems, which makes homebrew play nice with rubygems: gem install brewbygems
Install rvm and learn to love the different versions of ruby and rvm's gemsets feature: gem install rvm
Once you've done that you'll have a pretty robust development environment and you should be able to install any version of rails without a problem. Just keep in mind rails 3 works best using ruby 1.9.2 (install with rvm by running rvm install ruby-head) and is still in beta, meaning it isn't terribly stable and should not be used for anything production grade (yet).
I found the same error message, while after some google I've successfully installed it by manually 'sudo mkdir lib' in the .../gems/rails-3.0.0.beta3. Though it hasn't raised further problem, I hope someone could tell what should be in the missing lib directory.
You don't really need to do this sudo gem install rails --pre, simply sudo gem install rails. Rails3 is the default package now and out of beta.
It should work fine.
Might be a different solution on your OS, but I got the same exact error in Ubuntu and creating a ¨lib¨ folder under the rails gem folder solved my problem. I have explained the solution in the following post:
Installing Rails: "File not found: lib"
For convenience I will copy it here as well. The solution:
mkdir /lib/ruby/gems/1.8/gems/rails-{whatever your version is}/lib
Explanation: The ¨[sudo] gem install rails¨ command expects the /lib folder (at the end) but for some reason it hasn´t been created yet.
The original source of this solution was the following URL. Hope it helps!
http://www.spritle.com/blogs/?p=915
Same problem with beta 4.
The workaround is sudo gem install rails --pre --no-ri --no-rdoc though I don't know why.

Resources