Over time, we're upgrading pieces of our Rails 3.2.x application to be Rails 4 compatible. For example, any of our new code is written using strong parameters instead of attr_accessible
. We'd like to take a similar approach for features like ActiveRecord's none
and find_or_create_by
so we don't have to change much code when we finish our upgrade to Rails 4.
Is there a Rails 4 backports library that can assist us with this? We currently have a collection of monkey patches, but it seems like there would be a gem for this.
No, there is not. As you noticed, certain features are provided as a gem (such as strong_params
) that you can easily install in your previous version.
In case of some serious deprecations, the Rails core team normally includes a deprecation message in the old version along with a backport, so that you can fix the deprecation before upgrading the release.
In the case of none
, this is not a deprecation but a feature. Unless you find this in a gem, you are forced to upgrade to Rails 4 in order to use it.
find_or_create_by
is a deprecation, but Rails 4.0 still supports it. Thus you can upgrade and remove the code later.
Generally speaking, a backport with deprecation is normally provided only for those changes that will cause an incompatibility immediately after the upgrade preventing your application to even start or run properly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With