Validate if different?

Hi, I seem to remember seeing the equivalent of saving only if all
attributes are different. I can’t seem to find that now in the API or
the
agile book.

I’m using the acts_as_versioned and only want to save if the input is
different.

Thanks,

Steve
http://www.smarkets.net

you can simple compare posted hash with the database record, i.e.
something
like that

if (Model.find(id) == params[:model]) …

Thanks, Emin. Yes, that would work, but I thought I read someplace
onetime
there was a built-in method that woul do this.

Steve

never used acts_as_versioned, but quick look to api shows “changed?”
method
which should be what you are looking for

http://ar-versioned.rubyforge.org/classes/ActiveRecord/Acts/Versioned/ActMethods.html#M000010

Right on. Thanks Emin.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs