Yeah, but it's kinda misleading that update_attribute saved other
attributes and not just the one specified in the argument, being that the
method is "update_attribute" as a singular attribute. The reload works
fine, as the username was saved with update_attribute, which saved more
than what it was told to.



--------------------------------------
Sergio Campamá
sergiocamp...@gmail.com



On Wed, Mar 12, 2014 at 12:10 PM, Xavier Noria <f...@hashref.com> wrote:

> The point is that dirty attributes get persisted, not just the one you
> set. That is, the (invalid) username was saved because validations are
> skipped and the model as such is saved.
>
> Persisting dirty attributes is not an overlook, callbacks are run so you
> need to take the model as a whole and store it as a whole, with its current
> state, with all its consequences.
>
> The purpose of update_attribute was to save quick stuff, a flag toggle...
> that kind of things. Nowadays you'd generally use update_column.
>
> Xavier
>
> PS: Of course all this is documented, but we are discussing semantics, not
> documented behaviour.
>
>  --
> 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 rubyonrails-core+unsubscr...@googlegroups.com.
> To post to this group, send email to rubyonrails-core@googlegroups.com.
> Visit this group at http://groups.google.com/group/rubyonrails-core.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 rubyonrails-core+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-core@googlegroups.com.
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