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 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060324/6b244d1c/attachment.html
you can simple compare posted hash with the database record, i.e. something like that if (Model.find(id) == params[:model]) ... On 3/24/06, Steve Odom <steve.odom@gmail.com> wrote:> > 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 > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060324/f9bee117/attachment.html
Thanks, Emin. Yes, that would work, but I thought I read someplace onetime there was a built-in method that woul do this. Steve On 3/24/06, Emin Hasanov <emin@hasanov.com> wrote:> > you can simple compare posted hash with the database record, i.e. > something like that > > if (Model.find(id) == params[:model]) ... > > On 3/24/06, Steve Odom <steve.odom@gmail.com> wrote: > > > 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 > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060324/94740272/attachment.html
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 On 3/24/06, Steve Odom <steve.odom@gmail.com> wrote:> > Thanks, Emin. Yes, that would work, but I thought I read someplace onetime > there was a built-in method that woul do this. > > Steve > > > On 3/24/06, Emin Hasanov <emin@hasanov.com> wrote: > > > > you can simple compare posted hash with the database record, i.e. > > something like that > > > > if (Model.find(id) == params[:model]) ... > > > > On 3/24/06, Steve Odom <steve.odom@gmail.com> wrote: > > > > > 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 > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060324/db5c45d5/attachment.html
Right on. Thanks Emin. On 3/24/06, Emin Hasanov <emin@hasanov.com> wrote:> > 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 > > > On 3/24/06, Steve Odom < steve.odom@gmail.com> wrote: > > > > Thanks, Emin. Yes, that would work, but I thought I read someplace > > onetime there was a built-in method that woul do this. > > > > Steve > > > > > > On 3/24/06, Emin Hasanov <emin@hasanov.com> wrote: > > > > > > you can simple compare posted hash with the database record, i.e. > > > something like that > > > > > > if (Model.find(id) == params[:model]) ... > > > > > > On 3/24/06, Steve Odom <steve.odom@gmail.com> wrote: > > > > > > > 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 > > > > > > _______________________________________________ > > > Rails mailing list > > > Rails@lists.rubyonrails.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > > > > > > > _______________________________________________ > > > Rails mailing list > > > Rails@lists.rubyonrails.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060324/5efa471e/attachment.html
Maybe Matching Threads
- conditional updated_on update
- help: acts_as_versioned setup error "undefined local variable or method ''base_class''"
- login forms , redirect_to and ajax-scaffold problems
- distinguishing mapped urls from ordinary action urls
- How do I write this SQL the Rails way?