There is some bit of history here.
The purpose of update_attribute was to be able to touch an attribute fast,
set a flag for example... something you know can go straight to the
database. Indeed, update_attribute has *never* run validations.
There was some discussion about this method for Rails
I don't think that the 's' is a big enough change to make it
noticeable. I like update_column, maybe a bang method would make sense
too. But I'd expect them to both run validations.
Maybe deprecating one is a good idea.
--
You received this message because you are subscribed to the Google
Thanks for the history lesson Xavier.
Knowing that history, I like Steve's idea of deprecating update_attribute
and advertising update_column as the fast way to update a single column and
update_attributes as the way to run through the whole update stack.
On Thursday, June 14, 2012 5:39:38 AM
FWIW: This subtle difference disturbed me so much that I just alias
update_attribute to update_attribute*s*.
I'm very pleased to learn about update_column for the strange edge case
where you need it direct.
+1 for deprecation and emphasizing update_column.
On Thursday, 14 June 2012 08:31:22
Perhaps off topic -- I've got an unreleased gem that patches save() and
create() in ActiveRecord so that you can skip callbacks (and validations,
although I know you can already do that). You'd do something like
obj.save(:skip_callbacks = true, :skip_validations = true).
Is there a reason this
I personally find confusing the difference between `update_attributes` and
`update_attribute`. Intuitively, it seems that it is only a matter of
plural/singular (the first one changes more than one attribute through a
Hash argument and the second one changes only one through a column and a
value
Cool, so after this thread and some discussion we have decided to deprecate
update_attribute in 3-2-stable and remove it in Rails 4. Nowadays it has
little sense, and the singular/plural distinction does not seem to deserve
a dedicated method that does the same (if we added validations to
I'll give it a go right now.
--
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Core group.
To post to this group, send email to rubyonrails-core@googlegroups.com.
To unsubscribe from this group, send email to
Steve,
It'd be cool if the patch included the addition of a :validate = false
option in update_attributes.
This would make for an easier upgrade path from update_attribute.
Brian
On Thursday, June 14, 2012 9:34:39 AM UTC-7, Steve Klabnik wrote:
I'll give it a go right now.
--
You
On Thu, Jun 14, 2012 at 6:36 PM, Brian Morearty bmorea...@gmail.com wrote:
Steve,
It'd be cool if the patch included the addition of a :validate = false
option in update_attributes.
This would make for an easier upgrade path from update_attribute.
I think that would be a different
Xavier
I think I can give you a hand adding the deprecation.
On Thu, Jun 14, 2012 at 1:40 PM, Xavier Noria f...@hashref.com wrote:
On Thu, Jun 14, 2012 at 6:36 PM, Brian Morearty bmorea...@gmail.comwrote:
Steve,
It'd be cool if the patch included the addition of a :validate = false
On Thu, Jun 14, 2012 at 6:43 PM, Rodrigo Flores m...@rodrigoflores.orgwrote:
Xavier
I think I can give you a hand adding the deprecation.
Thanks Rodrigo, Steve already volunteered though :).
--
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Core
Hi,
Is there any particular reason why AR does not support composite primary keys?
This looks like a pretty nice feature to add.
Regards,
Luís Ferreira
--
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Core group.
To post to this group, send email
On Jun 14, 2012, at 12:36 PM, Brian Morearty wrote:
Steve,
It'd be cool if the patch included the addition of a :validate = false
option in update_attributes.
This would make for an easier upgrade path from update_attribute.
Note that there's one additional difference, due to attribute
On Friday, 15 June 2012 at 4:54 AM, Luís Ferreira wrote:
Hi,
Is there any particular reason why AR does not support composite primary
keys? This looks like a pretty nice feature to add.
Because outside of people with 'legacy schemas' there's not really a large
number of compelling use
This has now been merged, in both master and 3.2. Good job everyone!
--
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Core group.
To post to this group, send email to rubyonrails-core@googlegroups.com.
To unsubscribe from this group, send email to
Matt,
There is an option with update_attributes that allows the following to
bypass mass assignment protection:
some_object.update_attributes(foo: bar, {without_protection: true})
James
On Thursday, June 14, 2012 10:20:56 AM UTC-7, Matt jones wrote:
On Jun 14, 2012, at 12:36 PM, Brian
17 matches
Mail list logo