Globalize and Rails 4: Compatibility status - ruby-on-rails

In a my previous question (asked about 2 months ago) I was trying to upgrade Ruby on Rails from version 3.2.13 to 4.0.0, without success because the globalize3 ruby-gem compatibility. Today I'm trying again to do the upgrade, without success because the globalize3 ruby-gem compatibility.
I tried all possible solutions that I found on the web (even those that refer to the rails4 branch) but no one works for me: I get error outputs as-like those present in my previous question. However, as you can read here, it seems that someone (lucky, maybe) has solved the compatibility issue. I am not a "lucky" one and, since I aim to use features added by Rails 4 and still use globalize3, I would like to know if there is someone running Rails 4 and the globalize3 with success. If so, what did he / she made to make that?
What is the compatibility status between globalize3 and Rails 4?
Note: I also opened a issue at github.

I'm using it with rails 4 and have no issue.
In my Gemfile:
gem 'globalize3', github: 'svenfuchs/globalize3', branch: 'rails4'
Run bundle update instead of bundle install to resolve all dependencies again. Just lock gems that you don't want updated by indicating a version specifier as explained here http://bundler.io/v1.3/gemfile.html.

Related

Is that any ways to run pg_jobs gem in rails 7?

We are using pg_jobs gem for our rails 5 application but now we are trying to upgrade our application with rails 7 ...In that place, we are facing some issues like can't able to bundle the pg_jobs in rails 7 because it's supports the rails 5 only so can't able to run bundle install.
we tried to change the version of pg_jobs gem then also same error we are facing.
This is the error :
**Bundler could not find compatible versions for gem "rails":
In Gemfile:
rails (~> 7.0.4)
pg_jobs was resolved to 0.1.0, which depends on
rails (< 6.0, >= 5.1)```
**
The latest version of the pg_jobs gem (as of today) does not even support Ruby on Rails >= 6.0 yet (see Rubygems).
I would consider this gem being abandoned, taking into account that:
only one version of the gem was released ever
the gem does not support any up-to-date Rails version anymore and
the gem's source code didn't get any update in the last 3 years
That means your options are very limited, because it seems unreasonable to expect any updates from the gem's maintainer anymore. And downgrading your application is also not an option because then you were locked to an unsupported Ruby on Rails version.
The only two options I see are:
Fork the gem and update it to Ruby on Rails 7.0 on your own.
Switch to another ActiveJob worker implementation, like Sidekiq.
Forking and taking over maintenance feels like a burden, given that the gem doesn't seem to provide something very special or unique. Therefore, I suggest switching to another gem. Sidekiq is certainly the most popular nowadays, but there are other alternatives like Resque or DelayedJob (see Background Jobs on the Ruby Toolbox) that are worth it being considered depending on your requirements.

Gem compatibility and Ruby version

How to find out which gems need to be updated in a Rails app if the Ruby version is upgraded?
For example, I would like to know which of my Rails app gems will have to be upgraded if I upgrade my Ruby from 2.1.3 to 2.2.2. The preference would be to keep the changes minimal as to reduce the probability of things breaking.
The important thing would be for this to be a dry-run. So that one can assess the amount of work that an upgrade will require.
I have checked bundle and gem readme's without much luck.
If you update your rails version, it should install or resolve the required dependencies needed to run the new rails version. As far as as the gems you have entered that are NOT dependencys to Rails, you can check gem compatibility on rubygems.org. Just type in the title of your gem in the search bar.

How do I avoid the circular argument reference warning in activesupport

How do I avoid the circular argument reference warning in activesupport. Happens on ruby 2.2.0
/home/ec2-user/apps/foo_prod/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.21/lib/active_support/values/time_zone.rb:270: warning: circular argument reference - now
/home/ec2-user/apps/foo_prod/shared/bundle/ruby/2.2.0/gems/ruby-ole-1.2.11.7/lib/ole/types/base.rb:265: warning: duplicated key at line 266 ignored: 4095
Use Rails 3.2.22
gem 'rails', '3.2.22'
OR
warning fixes in version 1.2.11.8:
bundle update ruby-ole
This is an issue of Active Support and has been fixed with these two commits:
https://github.com/rails/rails/commit/8fd52705eda6a2cd7e9a8a5bc723fa094e359eb7
https://github.com/rails/rails/commit/3a30b12c774dfaa72acfe520e823374131631ea9
Unfortunately, these commits have been never included into the 3.2 releases,
because the current last release (v3.2.21) was out on 18 Nov 2014
and after that these commits were merged.
If you don't want to see this warning message definitely, you should change
your Gemfile like this:
# gem 'rails', '3.2.21'
gem 'rails', git: 'https://github.com/rails/rails.git', branch: '3-2-stable'
Otherwise, you should downgrade ruby to 2.1 or wait the release of v3.2.22,
which won't come until a grave security hole is found.
After all, there is no easy way to avoid this issue. Changing Gemfile
for such a trivial annoyance may be an overreaction in my view.
It will delay your deployment process quite a lot.
I was not using compass in my application Based on this post here I upped my Rails version from 4.1.1 to 4.1.9 which worked.
This is compass issue here. They haven't release new version yet so you may need to wait for it.
here is what i did to resolve that, i had the latest ruby and the gems are not compatible with that, so after having a fight for nearly a day i switched to older ruby version using rvm
from ruby-2.2.1 to ruby-2.0.0 ,
again this is not an issue with ruby version but incompatibility with gems,try and have good luck with that.
Well, Here is a solution to this:
Try doing all these changes in your .rbenv/.rvm folder and change in these files:
https://github.com/tmm1/rails/commit/8fd52705eda6a2cd7e9a8a5bc723fa094e359eb7
Hypothetically, updating to Rails 4.2.0 - which you should be able to do via the following commands - should fix this error, although it hasn't worked for me:
rvm use ruby-2.2.0#rails4.2 --create
gem install rails
rails -v
I'm getting the same "circular argument error" message as well (I posted more about my failed attempts to fix it here, will update if I find an answer: Rails gem update not working (version 4.1.1 to 4.2.0) as a solution to "warning: circular argument reference" error).
I altered the time_zone.rb file, instead of now=now, I entered now=Time.now and problem solved.
I ran into the same issue as well, yo can sue the following steps to resolve it (worked for me).
$ gem uninstall compass
$ gem update --system
$ gem install compass

Sass or Foundation Error after updating Rails and other gems

I have recently updated rails and some other gems. However now I get the following error:
Sass::SyntaxError at / Mixin "exports" does not accept a content
block. (in
/Users/mikhailja/Sites/marketing/app/assets/stylesheets/application.css.scss:341)
I'm using:
ruby 2.1.2
rails 4.1.8
sass 3.2.2
sass-rails 2.0.0
foundation-rails 5.4.5.0
The problem went away for a while after trying numerous gem versions but now all of a sudden its back after getting a stack level too deep error.
I've tried the same version of foundation in a new app and it works perfectly.
Any help to get to the bottom of this problem would be very much appreciated.
According to the Foundation github repo, it has to do with a Rails and Sass compatibility issue, which creates a Foundation compatibility issue because of their codebase. Apparently sass-rails has been recently updated to deal with this, and should solve the issue, but I'm not seeing any updates when I update my gems, so best way to deal with it now is probably to downgrade.
Edit: figured it out. In your Gemfile delete the specified version of sass-rails that's autogenerated then run update and you'll get the newest version which will work with the newest version of foundation.
I found a solution. Here is what I did for anyone else experiencing this problem:
Downgraded foundation-rails gem to version 5.1.1.0 (this was my original version) at this point my rails server would not start properly.
Then updated foundation-rails to version 5.3.0.0
I'm not sure if there was just a gem version compatibility issue or if the downgrade/upgrade made the difference.
Anyway, now everything works and my tests are passing!

Do I need to revert to an older version of Rails just to run a single legacy app (among other problems)?

I have an older Rails app that I need to run. But I have the latest version of Rails.
When I try to run this older app it says:
Missing the Rails 1.99.0 gem. Please
gem install -v=1.99.0 rails
But when I run the command: gem install -v=1.99.0 rails
ERROR: could not find gem rails
locally or in a repository
Not sure what to do next. Could someone help me understand what's happening here?
And my second question, related to this problem is: It seems silly that I need to revert to an older version of Rails just to run this one legacy app - there must be a better way of doing this?
AFAIK, v1.99.0 is sort of a v2.0 prerelease, so you could try installing v2.0.x, changing the RAILS_GEM_VERSION in config/environment.rb and runing rake rails:update.
If you think about it, it's not as silly as it might seem at first. You make an app using a fast evolving web framework as RoR. Your choices are: continue developing your app at aproximately the same pace the framework is evolving, or freeze the rails gem (and evertything else your app depends on, like gems, plugins) into your app in order to make it less fragile to expecting gem updates.
Regarding the second question: yes it is silly. Fortunately the Rails team spotted that silliness and at some point they gave us the ability to "freeze" the versions of Rails libraries required by an application (and also specific gem versions) into the vendor directory.
To freeze your version of Rails:
rake rails:freeze:gems
There's a good blog post from a while back describing this.
Unless you install and deploy RVM, your installation will roll back your system rails installation, which will impact your other projects. If you want to manually administrate your development environment this way, you can uninstall rails first, and then install the desired version of rails for the current project.
But try to install your rails gem instead with this syntax:
sudo gem install rails -v 1.99.0

Resources