Acts_as_versioned and qa


#1

Hi,
I have Article model and it has aasm_column qa, that is initially
“pending”.

In order to get it reset qa column on new versions, I have made:

def set_new_version
write_attribute(:qa, “pending”)
end

But now the aasm methods are also triggering the new version, dispite:

self.non_versioned_columns << ‘updated_at’
self.non_versioned_columns << ‘created_at’
self.non_versioned_columns << ‘qa’
self.non_versioned_columns << ‘published_at’

How to make the approve! method to start working, while data change
should trigger qa reset?

Tom

PS Here is saple code:

class Article < ActiveRecord::Base

include AASM

aasm_column :qa
aasm_initial_state :pending
aasm_state :pending
aasm_state :approved
aasm_state :rejected

aasm_event :approve do
transitions :from => :pending, :to => :approved, :guard => :valid?
end

aasm_event :reject do
transitions :from => :pending, :to => :rejected, :guard => :valid?
end

acts_as_versioned

self.non_versioned_columns << ‘updated_at’
self.non_versioned_columns << ‘created_at’
self.non_versioned_columns << ‘qa’
self.non_versioned_columns << ‘published_at’

def set_new_version
write_attribute(:qa, “pending”)
end

end