Save should already work with partial updates enabled, which means it won't
trigger an actual update on the database unless something has changed, so
there should be no need to check at this point.

Hope that helps.

On Fri, Oct 2, 2015 at 2:12 AM, Sean Teeling <[email protected]> wrote:

> Is there a reason why calling update_attributes saves even if no columns
> were changed? Currently the update_attributes aliases update which is
> defined:
>
> def update(attributes)
> with_transaction_returning_status do
> assign_attributes(attributes)
> save
> end
> end
>
> I was thinking it would be better to do `save if changed?`
>
> Thoughts? Sorry if this has been posted before
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/rubyonrails-core.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
At.
Carlos Antonio

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Reply via email to