Displaying 1 result from an estimated 1 matches for "first_artist_without_upd".
2006 Dec 26
0
alias_method_chain vs. redefined method with super
...round a bit and discovered alias_method_chain, so I finally ended up
with:
class Duo < Artist
belongs_to :first_artist, :class_name => ''Artist''
belongs_to :other_artist, :class_name => ''Artist''
def first_artist_with_update= (first_artist)
self.first_artist_without_update = first_artist
update_name # sets name to first_artist.name + other_artist.name
end
alias_method_chain :first_artist=, :update
...
end
Thinking that was a pretty cool way to extend a method, I went back and
tried to use the same scheme for Musician, but there I get the missing
method...