I have the  below code - I cannot use alias_method_chain unless I
declare :accepted= before using it - i suppost the attribute methods
are added latter - I suspect that this case is blowing away my
alias_method_chain

How can i complete this intention correctly, doing it the rails-way and pretty?

Thanks
 Curtis.


class IncomingVideo < ActiveRecord::Base
  validates_presence_of :content_url
  validates_presence_of :title

  def uncurated?
      !accepted?
  end
  def accepted=(val)
    update_attribute(:accepted,val)
  end

  def accepted_with_create_curated_video=(val)
    if uncurated? and val == true
      cv = CuratedVideo.create(:title => title,
                          :description => description,
                          :content_url => content_url,
                          :site_url => site_url)
      cv.save!
    end
    accepted_without_create_curated_video=val
  end
  alias_method_chain :accepted=,:create_curated_video
end

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.


Reply via email to