Are not both cases invalid input? Why should we accept empty hashes?

On Thu, May 7, 2015 at 2:14 PM Michael Mahemoff <mahem...@gmail.com> wrote:

> The following will return an error:
>
>     > Post.first.update_columns({})
>     ArgumentError: Empty list of attributes to change
>
> I think that's surprising, because I see update_columns as an analogue to
> update_attributes, just without callbacks happening. An empty hash for the
> latter is fine:
>
>     > Post.first.update_attributes({})
>     true
>
> So shouldn't update_columns support an empty hash too? In the rare cases
> where callbacks should be avoided and this is needed, it would save having
> to make a special-case check to prevent the error.
>
> --
> 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