[Rails] How do I overwrite AR-created magic methods?

Jeremy Kemper jeremy at bitsweat.net
Fri Dec 3 06:49:19 GMT 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Sascha Ebach wrote:
| how do I overwrite the size method that gets created by AR (or is it?).

Here is a patch which adds :counter_sql option for has_many.
~  http://dev.rubyonrails.org/trac.cgi/ticket/265

~  class Contentnode < ActiveRecord::Base
~    has_many :children, :class_name => 'Contentnode',
~             :finder_sql  => 'SELECT * FROM contentnodes ...'
~             :counter_sql => 'SELECT COUNT(*) FROM contentnodes ...'
~  end

Best,
jeremy
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (Darwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBsAxvAQHALep9HFYRAiiVAKCgjIuGNK24Q2Atgz+FJ1lylA/BmwCgnDcF
zUXFN5v1tT+pjBDmuSNyjn4=
=Ucgu
-----END PGP SIGNATURE-----


More information about the Rails mailing list