Hello, I have a database table with a primary key not being a simple id but three columns. By overriding update() and create() I got Rails to work with that table quit good. Except for the destroy() action. From the resulting trace I can see that the old version of destroy() is called from transaction.rb. I think this lines might be the reason that I''m unable to override detroy(): from transaction.rb def self.append_features(base) super base.extend(ClassMethods) base.class_eval do alias_method :destroy_without_transactions, :destroy alias_method :destroy, :destroy_with_transactions ... Any ideas, hints, etc.? best regards, Torsten
Torsten Robitzki wrote:> Hello, > I have a database table with a primary key not being a simple id but > three columns. By overriding update() and create() I got Rails to work > with that table quit good. Except for the destroy() action. From the > resulting trace I can see that the old version of destroy() is called > from transaction.rb. I think this lines might be the reason that I''m > unable to override detroy():Add on: My fault, I simply picked the wrong model class. Now with overloading update(), create() and destroy() in the right model class with natural primary keys every thing works as expected. best regards Torsten
Apparently Analagous Threads
- Problem with ActiveForm
- Overriding class_attribute writers and order of super/extend C.M./included block eval in ActiveSupport::Concern
- "include" versus "extend" - what's the difference
- Explanation of "alias_method"
- Fwd: help me override ActiveRecord find?