Re: [Rails-core] ActiveRecord update_attribute vs update_attributes

2012-06-14 Thread Xavier Noria
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

Re: [Rails-core] ActiveRecord update_attribute vs update_attributes

2012-06-14 Thread Steve Klabnik
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

Re: [Rails-core] ActiveRecord update_attribute vs update_attributes

2012-06-14 Thread MikeGehard
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

Re: [Rails-core] ActiveRecord update_attribute vs update_attributes

2012-06-14 Thread Simon de Boer
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

Re: [Rails-core] ActiveRecord update_attribute vs update_attributes

2012-06-14 Thread Peter Inglesby
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

Re: [Rails-core] ActiveRecord update_attribute vs update_attributes

2012-06-14 Thread Rodrigo Flores
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

Re: [Rails-core] ActiveRecord update_attribute vs update_attributes

2012-06-14 Thread Xavier Noria
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

Re: [Rails-core] ActiveRecord update_attribute vs update_attributes

2012-06-14 Thread Steve Klabnik
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

Re: [Rails-core] ActiveRecord update_attribute vs update_attributes

2012-06-14 Thread Brian Morearty
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

Re: [Rails-core] ActiveRecord update_attribute vs update_attributes

2012-06-14 Thread Xavier Noria
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

Re: [Rails-core] ActiveRecord update_attribute vs update_attributes

2012-06-14 Thread Rodrigo Flores
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

Re: [Rails-core] ActiveRecord update_attribute vs update_attributes

2012-06-14 Thread Xavier Noria
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

[Rails-core] Composite Primary Keys

2012-06-14 Thread Luís Ferreira
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

Re: [Rails-core] ActiveRecord update_attribute vs update_attributes

2012-06-14 Thread Matt Jones
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

Re: [Rails-core] Composite Primary Keys

2012-06-14 Thread Michael Koziarski
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

Re: [Rails-core] ActiveRecord update_attribute vs update_attributes

2012-06-14 Thread Steve Klabnik
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

Re: [Rails-core] ActiveRecord update_attribute vs update_attributes

2012-06-14 Thread James Miller
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