Displaying 1 result from an estimated 1 matches for "first_artist_with_upd".
2006 Dec 26
0
alias_method_chain vs. redefined method with super
...he method didn''t exist in super.  I dug
around 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 sch...