Forum: Ruby on Rails how to disable callback

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Iphan I. (Guest)
on 2006-05-31 16:55
How do I locally disable a callback from being performed?

My class has

class Keyword < ActiveRecord::Base

after_update :switch_versioned

    private
      # Callback used to warn the user that an updated record
      # has not been saved in the version table
      def switch_versioned
        logger.debug "coucou"
        self.versioned= false
      end


But another class has a method that sets

@keyword.versioned= true


so in this case I want to disable the callback... there is probably a
better way to do it?

any help appreciated

Isabelle
This topic is locked and can not be replied to.