Rails 3 and mongoid setup - ruby-on-rails-3

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

Related

Rails 4.0.8 Bundle Install keeps poiting to the wrong Ruby version

I'm working through the Railstutorial with Rails 4.0.8. and Ruby 2.1.2. Recently Bundle Install, Rails Console and Rails Server seem to ALWAYS choose the alternate version of Ruby from whichever is specify in my Gemfile. When I enter ruby -v it also always suggests the OTHER version.
Is this a bash_profile problem and how can I set it to permanently leave the internal OS X Ruby (v2.0.0) alone and just use v 2.1.2 where all my gems are installed?
I'm using rvm and Homebrew... I suspect both may be adding to the confusion...
Any helpful tips?
First...
micanansmbp:sample_app micanan$ rails console
Your Ruby version is 2.1.2, but your Gemfile specified 2.0.0
Then...
micanansmbp:sample_app micanan$ bundle install
Your Ruby version is 2.0.0, but your Gemfile specified 2.1.2
Finally...
micanansmbp:sample_app micanan$ bundle install
Your Ruby version is 2.0.0, but your Gemfile specified 2.1.2
micanansmbp:sample_app micanan$ ruby -v
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]
micanansmbp:sample_app micanan$

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

file 'lib' not found when installing rails 3.1 on Mac OS X Lion

I just installed rvm and then rails 3.1rc5 with:
gem install rails --pre
But I got some errors after "Installing ri documentation" and the RDoc documentation:
Successfully installed <bunch of things>
30 gems installed
Installing ri documentation for multi_json-1.0.3...
Installing ri documentation for activesupport-3.1.0.rc5...
Installing ri documentation for builder-3.0.0...
unable to convert "\xF1" from ASCII-8BIT to UTF-8 for README, skipping
unable to convert "\xF1" from ASCII-8BIT to UTF-8 for README.rdoc, skipping
Installing ri documentation for i18n-0.6.0...
Installing <tons more documentation>
Installing ri documentation for rails-3.1.0.rc5...
file 'lib' not found
Installing RDoc documentation for multi_json-1.0.3...
Installing RDoc documentation for activesupport-3.1.0.rc5...
Installing RDoc documentation for builder-3.0.0...
unable to convert "\xF1" from ASCII-8BIT to UTF-8 for README, skipping
unable to convert "\xF1" from ASCII-8BIT to UTF-8 for README.rdoc, skipping
Installing RDoc documentation for i18n-0.6.0...
Installing <tons more documentation>
Installing RDoc documentation for rails-3.1.0.rc5...
file 'lib' not found
The README file issues don't seem to be a big deal, but the 'lib' file not found sounds a bit scary.. why is it doing that? Some searching revealed others having this problem and fixing it with gem install rdoc and then re-running gem install rails --pre. But that still gives the same lib file missing errors for me.
Try using rvm gemset install rails --pre
I installed 3.1.0 on Windows (not rc8, but the final release), and got the "file 'lib' not found" error, installing both ri and RDoc. When I type in 'which ruby', I see it installed in the c:/ruby192/bin directory. I had to create a .rvm directory for myself -- it was not created as part of the install.
the --no-rdoc --no-ri worked, of course. The --pre commands installed rc8 instead of the final release.
What gives?
Installing RDoc fixed this problem for me. I had to do this in the gemset I was using.
rvm use rubyversion#gemset
gem install rdoc
After this I could install gems without the "file 'lib' not found" error.
I had the same problem with rails 3.0.9 on my Mac OS X Lion and the "rvm gemset install rails" trick solved it !
$ rvm gemset install rails
installing rails ...
rails installed.
$ rails -v
Rails 3.0.9
Thanks !
I had a similar issue before, while my solution was this: try to use ruby 1.9.2-head instead of ruby 1.9.2-p290.
rvm install ruby-1.9.2-head
rvm use ruby-1.9.2-head --default
And then, install rails 3.1 again.

Mac OS X Leopard showing different version of Rails after install

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.

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