Have Rails 2.3.x ignore the i18n gem - ruby-on-rails

I have a Rails 2.3.5 project that uses the localization features of Rails. I also happen to have Rails 3 beta installed (which depends on the i18n gem). Rails 2.3.5 will happily handle localization on it's own (without i18n installed), however if the i18n gem is available, it makes use of it.
Recently I upgraded my gems and now have version 0.3.7 and 0.4.0 of i18n installed. Rails, of course, wants to load and use the latest version which is causing errors in my project. I tried setting the gem version to 0.3.7 which gets around the errors in the web app. However, we're using resque and resque_mailer to delay the sending of messages. When the worker picks up the mailer job from the queue, it ignores my config.gem requirement in environment.rb and uses version 0.4.0 anyway.
Ideally, I'd like to tell Rails to just not use the i18n gem at all. How do I do that?
Update: As of beta 4, Rails 3 now requires i18n version 0.4.1. I don't see how more people aren't running into this problem as it would seem now if you have both Rails 2 and Rails 3 installed, you're going to run into this.

I followed instructions as defined here:
http://gembundler.com/rails23.html
and it worked.

You could use Bundler or RVM's Gemsets to make the i18n gem unavailable from within your app. Or you could upgrade your Rails app.

Freeze the rails version: rake VERSION=2.3.5 rails:freeze:gems
Fix the version in the file vendor/rails/activesupport/lib/active_support/vendor.rb line 24 to: gem 'i18n', '>= 0.1.3', '< 0.4.0'

Or just edit: /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/vendor.rb
And turn gem 'i18n', '>= 0.1.3'
Into gem 'i18n', '0.1.3'

Related

Is Nokogiri necessary for Rails?

I updated my Ruby from 1.9 to 2.2 and I found that the Nokogiri gem doesn't support Ruby 2.2 on Windows. Nokogiri was not in my Gemfile, but when I run bundle install it is automatically added. Maybe there are some dependency for it?
This is a very small project and I don't understand its necessity for the project.
Is it possible to use Ruby 2.2 without Nokogiri? Or should I downgrade to 1.9 again?
It looks like Nokogiri is required by rails-dom-testing which is required by Action Pack and Action View in Rails 4.2.3, so it seems difficult to bypass it.
It looks like it is a dependency of some gem, which is included in your Gemfile.
You can search for nokogiri in your Gemfile.lock to find a gem which is requiring it.
See https://github.com/sparklemotion/nokogiri/issues/1256
tl;dr, in your Gemfile:
gem 'nokogiri', '>= 1.6.7.rc3'
for Windows.

Sass 3.3 RC1 in Rails app using sass-rails gem

I want to update my in development Rails app to use the newly released Sass 3.3 RC1. How can I do this if I am using the sass-rails gem?
You merely refer to the master branch of the github repository in this case; Was able to immediately use Sass 3.3 RC! with zero issues within the context of Rails.
Don't forget to upgrade Compass as well the same way:
gem "compass", github: "chriseppstein/compass"
gem "compass-rails", github: "Compass/compass-rails"
Update: merely typing bundle update worked for me on another Rails 4 project to get Sass 3.3.rc1

haml-rails on rails 4.0?

I'm wondering if anyone has run into any snags with the haml-rails gem in Rails 4.0. There is a Rails Cast that says there were some problems but there is not much more mention of this. The gem hosted on GitHub also doesn't explicitly mention support for Rails 4.0. So what's the status on this?
I'm using haml-rails (0.4) in a rails 4 project and everything is working
Haml 4.0.4 have release to support rails 4 application. You can use haml-rails. Now, it doesn't have problem. Include gem package in gem file
gem 'haml-rails'
and bundle the project

Why does acts-as-taggable-on upgrade rails gem from 3.1.1

I have a rails app that uses rails gem v3.1.1 and acts-as-taggable-on gem v2.1.1.
Our server build installs the rails v3.1.1 gem before the acts-as-taggable-on v2.1.1 gem.
My problem is that installing the acts-as-taggable-on gem also installs the latest rails (3.2.1) even though I already have rails installed and I end up with 2 versions of rails installed.
Looking at the acts-as-taggable-on gemspec it has rails as a dependency. On install, I would expect acts-as-taggable on to know that the rails gem is installed and not install the latest version.
Can you explain why it installs rails again, and if there is a way to stop it?
Thanks in advance.
Version 2.2.2 of the gem bumps the Rails dependency down to 3.x instead of 3.2. If you're able to upgrade acts-as-taggable-on, switch to v2.2.2 and you should no longer have a dependency clash.

Rails - Understanding Gems

I'm using the rails devise gem. I noticed a case sensitivity bug which turns out is fixed in the latest version of devise so I'm thinking about upgrading.
In my gem file I have:
gem 'devise', '~> 1.1.3'
When I run bundle I get:
Using devise (1.1.9)
Why the difference. And what setting should I be using in my gem file to upgrade to the latest and greatest?
Thanks
The ~> in your Gem declaration says that Bundler can install any version up to the next major version, so in this case it could install any version of devise that is => 1.1.3 and < 1.2.0.
Including the ~> is good practice, as it means security updates are automatic if the gem is using versioning correctly; in a production environment, you'll probably want to drop this moniker, though, and just set your gem versions statically to avoid issues.
To update to the latest version of the gem, everytime, just use the following with no second version argument:
gem 'devise'
See more information on the Gemfile format at http://gembundler.com/gemfile.html.
Just use :
gem 'devise'
and you will be getting the latest stable gem :)
The difference is because you're telling to Bundler to use 1.1.3 or a major version of this gem in you system, if you want to use a specific version just put '1.1.9' in the version param.
use bundle update devise to update the devse gem and bundle update to update all the gems (which is not advisable)
http://jsbin.com/ihiqe4
if you know the version number you want, try this (assuming it's 1.2.3):
gem 'devise', '1.2.3'
or just leave out the version number
if it has not been released yet, you can point to it's github repository instead.

Resources