[Catalyst] ActiveRecord for Perl

mreece at vinq.com mreece at vinq.com
Tue May 22 14:53:00 GMT 2007


> On 5/22/07, Adam Bartosik <adam.bartosik at hurra.com> wrote:

> I doubt there's anything worth porting in ActiveRecord that one of the
> many Perl options (DBIx::Class, Rose::DB::Object, Class::DBI, Tangram,
> Alzabo) doesn't provide.
>
> - Perrin

one thing i really like about AR is the association proxies, where
relationships themselves are objects you can call methods (ie, find) on

  class User < ActiveRecord::Base
    has_many :items
  end
  class Item < ActiveRecord::Base
    belongs_to :user
  end

  items = user.items
  item = user.items.find(params[:id])
  new_item = user.items.create!(params[:item])

you can get close to that with RDBO's $user->find_items() (and maybe DBIC
has something similarish) but the ruby way here feels so much better!





More information about the Catalyst mailing list