Rails 3 version of ActiveRecord usable with Rails 2?

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.)

Thanks!
Jeff

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:

http://gemcutter.org/gems/activerecord/versions/3.0.0.beta

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:

http://gemcutter.org/gems/rails/versions/2.3.5

http://gemcutter.org/gems/rails/versions/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.

-Conrad

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.

Thanks again,
Jeff

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:

http://gemcutter.org/gems/activerecord/versions/3.0.0.beta

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:

http://gemcutter.org/gems/rails/versions/2.3.5

http://gemcutter.org/gems/rails/versions/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).

You need to look at all the dependencies for Rails 2.3.5 requires these

exact dependencies:

Runtime Dependencies

  1. activeresource = 2.3.5
  2. actionmailer = 2.3.5
  3. actionpack = 2.3.5
  4. activerecord = 2.3.5
  5. activesupport = 2.3.5
  6. rake >= 0.8.3

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:

http://guides.rails.info/3_0_release_notes.html

http://guides.rails.info

Good luck,

-Conrad