Dynamically chain class methods

Hi all,

I was wondering if it is possible to dynamically chain class methods in
rails. Suppose there are several optional methods that a class may have,
I
want to chain call all the methods that apply to a certain class. Is it
possible? What is the best approach to do achieve this?

Thanks in advance.


Anderson M.
www.aposasopa.com
Linux User #419944

2009/8/12 doug [email protected]

On Sep 1, 11:23 am, Anderson M. [email protected] wrote:

Hi all,

I was wondering if it is possible to dynamically chain class methods in
rails. Suppose there are several optional methods that a class may have, I
want to chain call all the methods that apply to a certain class. Is it
possible? What is the best approach to do achieve this?

ActiveSupport::Callbacks ?

Fred

On Tue, Sep 1, 2009 at 6:23 AM, Anderson M.[email protected]
wrote:

Hi all,

I was wondering if it is possible to dynamically chain class methods in
rails. Suppose there are several optional methods that a class may have, I
want to chain call all the methods that apply to a certain class. Is it
possible? What is the best approach to do achieve this?

ActiveSupport defined Module#alias_method_chain which is used
extensively to do what I think you are asking for.

Googling alias_method_chain should fill you in on the details.


Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Twitter: http://twitter.com/RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs