module Diffable::ClassMethods
Attributes
Holds an array of fields which will be added to a modified change Hash (regardless of whether its value has changed or not) unless there are no other changes
A shortcut, used to quickly check whether a class implements Diffable
Holds an array of excluded fields which will not be used for comparison tests or when copying deleted values
String value corresponding to the field that uniquely identifies a child record from among its siblings (should not be id unless id is being generated)
Public Instance Methods
Sets the class’s conditional_fields
values.
If required, should be placed in the model definition code:
class ModelA < ActiveRecord::Base include Diffable set_conditional_fields :meta end
# File lib/diffable.rb, line 270 def set_conditional_fields(*h) @conditional_fields = [] h.each { |key| eval(%Q|@conditional_fields << "#{key.to_s}"|) } end
Sets the class’s excluded_fields
values.
If required, should be placed in the model definition code:
class ModelB < ActiveRecord::Base include Diffable set_excluded_fields :ignore_me, :test end
# File lib/diffable.rb, line 284 def set_excluded_fields(*h) @excluded_fields = [] h.each { |key| eval(%Q|@excluded_fields << "#{key.to_s}"|) } end
Sets the class’s unique_within_group
value
If required, should be placed in the model definition code:
class ModelC < ActiveRecord::Base include Diffable set_unique_within_set :generated_identifier end
# File lib/diffable.rb, line 298 def set_unique_within_group(value) eval(%Q|@unique_within_group = "#{value.to_s}"|) end