Mac OS X Leopard showing different version of Rails after install - ruby-on-rails-3

so I'm installing rails with
gem install rails
and I didn't have any version of rails prior to the one I'm installing (3.0.9).
By the time the installation finishes I get the documentation error
Installing ri documentation for rails-3.0.9...
file 'lib' not found
Installing RDoc documentation for rails-3.0.9...
Even though it says that rails 3.0.9 was installed successfully.
If I run
gem list rails
it shows me version 3.0.9, but when I run
rails -v
it shows me version 2.3.5 ( I don't know here that came from ).
See: http://cl.ly/353h1o1b3y3T260L3F3p
Any help please?

If you don't really care, just remove rails 2.3.5 with gem uninstall rails and chose the appropriate one when it asks you which.

Related

Getting Rails working with a JS runtime environment

I'm using Ubuntu 11.10 and the terminal to install and run Rails. Here
is the process I've taken so far to setup Rails:
download and install Ruby 1.9.2 and Rails 3.1.0
-- I did this using sudo apt-get ruby1.9.1 and sudo gem install
rails
I made a new rails app using rails new path/to/app
I went to the new app directory and tried running rails server and got an
error about not having a JS ruby environment
I had to get a JS runtime environment for execjs so I downloaded 'therubyracer'
as well as 'therubyrhino' and added them to my gem file, one at a time like this:
gem
'therubyracer' then ran bundle install
After everything was successful with the install, I ran rails server again
-- with both runtime environments I have had similar errors:
Could not find libv8-3.3.10.4 in any of the sources
Run `bundle install` to install missing gems.
Could not find therubyrhino-1.73.0 in any of the sources
Run `bundle install` to install missing gems.
Bundle knows where these programs live, giving correct pathnames when I
enter bundle show libv8 or bundle show therubyrhino. They are both
in /usr/lib/ruby/gems/1.9.1/gems/_ where all the other gems are
located for the bundle install.
Does anyone know where this exception is coming up in the Rails source
code? Does anyone know how Rails is gathering the gems? Better yet,
anyone had this problem and know how to fix it?
Thanks so much,
Feav
Have you tried starting the server using bundle exec rails server?
This problem has been fixed in a newer version of Rails.

Rails 3 and mongoid setup

I'm trying to follow the Railscasts on mongoid
http://railscasts.com/episodes/238-mongoid
When I install the mongoid and bson_ext gem it seems fine, but each time that I run a rails command, like:
rails g scaffold article name:string content:text
I get a warning in the console:
Able to load bson_ext version 1.3.1, but >= 1.4.1 is required.
But I can't find a bson_ext 1.4.1, current version seems to be 1.3.1 in the rubygems directory.
Is there an other step that I missed?
Finally found the answer to that bson 1.4 mistery
http://rubygems.org/gems/bson/versions/1.4.1-jruby
need to be installed with the -v flag
gem install bson -v 1.4.1
Default bson is 1.3, and ~> 1.4 has been pulled out from gems repo. Need to be download and installed manually. But they recommend to wait for 1.4.2 .
Issue is referenced here too:
Bundler: "Could not find bson-1.4.0 in any of the sources"
You need to run
gem update bson_ext

Getting error neo4j [not found] when trying to generate a model

I installed JRuby and the neo4j gem and trying to use a generator to create a model:
jruby -S rails generate scaffold User name:string born:date --orm=neo4j
However, I get this error:
error neo4j [not found]
I tried installing neo4j through bundler and just gem install. Either way, which neo4j returns nothing.
I tried this with the the neo4j-rails gem as well but I the neo4j rubyforge page says it is no longer needed. I also tried just generating a model rather than a scaffold.
Is this error specific to just generators or does it mean that my neo4j installation didn't work?
Your installation did not work.
The problem is that you have probably installed version 0.4.6 which is not specific to the JRuby platform but also installs (incorrectly) on MRI. So the error 'neo4j [not found]' is because you are using JRuby and installed the neo4j.rb gem in MRI. Neo4j.rb version >= 1.0.0 can only be installed on JRuby.
I recommend using RVM:
rvm install jruby
rvm use jruby
gem install bundler
bundle install

Rails Server Won't Run on OS X Lion

I'm a beginner programmer and I'm trying to get the rails server to run on OS X Lion. When I type "rails server" into the command line, I get this error:
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:777:in `report_activate_error': Could not find RubyGem rails (>= 0) (Gem::LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:211:in `activate'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:1056:in `gem'
from /usr/bin/rails:18
What do you think a solution to the problem is? Any help you can provide would be greatly appreciated. Thanks!
You need to install the rails gem. You could probably do this by running bundle install inside that project.
Have you installed the Rails Gem?
gem install rails
Then do a gem list to see if Rails is in there.
It's also important that you be in the proper directory. So if you keep all of your apps in /apps/ make sure you are in /apps/my_app before calling the server command.
The Ruby bundled with OS X is too old for Rails 3.
I would recommended using 'rvm' to install the latest stable version of ruby-1.9.2-p260
Since installing ruby requires some compilation, make sure you have a gcc installed. You can install XCode to get an usable gcc.
To install rvm, you need bash, git and curl.
RVM: http://beginrescueend.com/
After that, you can use
gem install rails
Enjoy!
The Lion Server looks at a non-default path for the gem file
For example have a look at the first line of /usr/share/devicemgr/backend/devicemgrd:
#!/usr/bin/env GEM_HOME=/usr/share/devicemgr/webserver/gems GEM_PATH=/usr/share/devicemgr/webserver/gems RAILS_ENV=production /usr/bin/ruby
So to install the missing gems, make sure to install them at the required path:
sudo GEM_HOME=/usr/share/devicemgr/webserver/gems gem install rails

Problems with installing mail gem for Rails 3

I'm trying to install rails 3.0.7 on Mac OSX. I'm using rvm and I've got ruby 1.9.2p180 installed.
When I run
gem install rails --version 3.0.7
It seems to work fine, until it gets to the mail gem.
Fetching: mail-2.2.17.gem (100%)
ERROR: While executing gem ... (Zlib::DataError)
invalid block type
The installer them stops and rails is not installed. How do I get around this?
Update: Since I asked this question the mail gem has been updated to 2.2.19, and this seems to have solved the problem.
I just replicated your env (MacOS, ruby 1.9.2) and rails installed fine, along with the mail gem (2.2.17).
Perhaps try again? Maybe the package that was fetched was temporarily corrupt. You can also run gem with the verbose flag to see more info:
gem install rails -V --version 3.0.7