This change enables the ActiveModel::Dirty syntax that is to be expected for native ActiveRecord classes:
class Foo < PushType::Node
field :bar
end
foo = Foo.new
foo.bar = "baz"
foo.bar_changed? #=> true
I was recently motivated by a rather complicated validation I needed recently where I needed to verify an audio file and wanted conditional validation and quickly realized that I didn't have it, but knew it was easy to piggyback onto Rails' built-in features:
field :audio_recording_url, :string
before_validation :inspect_metadata, :if => :audio_recording_url_changed?
def inspect_metadata
# perform metadata inspection
end
This change enables the ActiveModel::Dirty syntax that is to be expected for native ActiveRecord classes:
I was recently motivated by a rather complicated validation I needed recently where I needed to verify an audio file and wanted conditional validation and quickly realized that I didn't have it, but knew it was easy to piggyback onto Rails' built-in features: