Anybody know if the changes coming to Rails 3 that affect ActiveRecord
can be applied to Rails 2.x projects as well? If it’s just the
ActiveRecord gem that’s changing, then we should be able to use the
new ActiveRecord gem with Rails 2 apps, right?
(I ask because I’ve had trouble trying it out myself; installing the
Rails 3 beta gems somehow hosed my ability to create rails 2.x apps,
so until I straighten that out, I’m hoping someone might have seen
some news/insight that I haven’t come across yet.)
Anybody know if the changes coming to Rails 3 that affect ActiveRecord
can be applied to Rails 2.x projects as well? If it’s just the
ActiveRecord gem that’s changing, then we should be able to use the
new ActiveRecord gem with Rails 2 apps, right?
No, this isn’t possible. Why? ActiveRecord in Rails 3 is dependent on
other Rails 3.0 gems. For example, AR in Rails 3 depends on the
following gems:
As an exercise for yourself, you can use the above to navigate the
entire
dependency graph and it should be clear why your approach wouldn’t be a
good idea. Furthermore, you can compare the dependency graph for both
Rails 2.3.5 and Rails 3.0.0 beta:
(I ask because I’ve had trouble trying it out myself; installing the
Rails 3 beta gems somehow hosed my ability to create rails 2.x apps,
so until I straighten that out, I’m hoping someone might have seen
some news/insight that I haven’t come across yet.)
Please post your issue(s) here with sufficient detail and the community
will attempt to assist you.
As an exercise for yourself, you can use the above to navigate the entire
dependency graph and it should be clear why your approach wouldn’t be a
good idea. Furthermore, you can compare the dependency graph for both
Rails 2.3.5 and Rails 3.0.0 beta:
Interesting, thanks for the links. ActiveRecord 3.0 depends on Arel,
ActiveModel, and ActiveSupport. The only common dependency I see is
ActiveSupport. If I could get a Rails 2.3.5 app to bind to
ActiveSupport “>= 2.3.5”, instead of exactly equal to 2.3.5, then
perhaps it might work. Except, that I don’t know if there are
breaking changes in ActiveSupport 3.0 that break Rails 2.3.5 apps
(there probably are).
I guess I just wish the new ActiveRecord/ActiveSupport functionality
could have been added to Rails 2.x, and we could have a new version
like Rails 2.4, rather than only being available with Rails 3.0.
Interesting, thanks for the links. ActiveRecord 3.0 depends on Arel,
ActiveModel, and ActiveSupport. The only common dependency I see is
ActiveSupport. If I could get a Rails 2.3.5 app to bind to
ActiveSupport “>= 2.3.5”, instead of exactly equal to 2.3.5, then
perhaps it might work. Except, that I don’t know if there are
breaking changes in ActiveSupport 3.0 that break Rails 2.3.5 apps
(there probably are).
You need to look at all the dependencies for Rails 2.3.5 requires these
exact dependencies:
Rails 2.3.5 requires ActiveSupport 2.3.5 (i.e. you cannot use an earlier
version or a later version) of this gem. Next, the rake and bundler
gems
are compatible with both versions of Rails.
I guess I just wish the new ActiveRecord/ActiveSupport functionality
could have been added to Rails 2.x, and we could have a new version
like Rails 2.4, rather than only being available with Rails 3.0.
Please understand that the Rails core team have re-architected many of
the
common components. Thus, you’ll need to upgrade to benefit from these
changes and I would highly recommend reading the following as well as
the
associated links:
Good luck,
-Conrad
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.