Re: [Rails-core] ActiveResource::Base#dup should take standard new/create args

2012-07-10 Thread Kurt Werle
On Monday, July 9, 2012 12:10:07 PM UTC-7, Nicolás Sanguinetti wrote: dup doesn't take arguments because in ruby dup doesn't take arguments. It wouldn't make sense to break the semantics of ruby just for this, IMO. I had not considered that. On the other hand: * it's not like dup calls

Re: [Rails-core] ActiveResource::Base#dup should take standard new/create args

2012-07-10 Thread Nicolás Sanguinetti
On Tue, Jul 10, 2012 at 12:36 PM, Kurt Werle k...@circlew.org wrote: On Monday, July 9, 2012 12:10:07 PM UTC-7, Nicolás Sanguinetti wrote: dup doesn't take arguments because in ruby dup doesn't take arguments. It wouldn't make sense to break the semantics of ruby just for this, IMO. I had

[Rails-core] ActiveResource::Base#dup should take standard new/create args

2012-07-09 Thread Kurt Werle
dup takes no args create and new both take the same args, and create can take a block It seems to me it would be more consistent (and convenient) if I could do some_record.dup(attributes_i_want_to_change) do |dup_record| dup_record.attribute = some_value

Re: [Rails-core] ActiveResource::Base#dup should take standard new/create args

2012-07-09 Thread Duncan Beevers
Sounds nice. On Mon, Jul 9, 2012 at 12:23 PM, Kurt Werle k...@circlew.org wrote: dup takes no args create and new both take the same args, and create can take a block It seems to me it would be more consistent (and convenient) if I could do some_record.dup(attributes_i_want_to_change) do

Re: [Rails-core] ActiveResource::Base#dup should take standard new/create args

2012-07-09 Thread Steve Klabnik
Not only breaking Ruby semantics, but you can get what you want with this: some_record.dup.tap do |dup_record| dup_record.attribute = some_value self.relationship.dup(reverse_relationship: dup_record) end -- You received this message because you are subscribed to the Google Groups Ruby on

Re: [Rails-core] ActiveResource::Base#dup should take standard new/create args

2012-07-09 Thread Francesco Rodriguez
What about initialize_dup? El jul 9, 2012 2:11 p.m., Nicolas Sanguinetti godf...@gmail.com escribió: dup doesn't take arguments because in ruby dup doesn't take arguments. It wouldn't make sense to break the semantics of ruby just for this, IMO. Cheers, -foca On 09/07/2012, at 14:23,

Re: [Rails-core] ActiveResource::Base#dup should take standard new/create args

2012-07-09 Thread Nicolás Sanguinetti
On Mon, Jul 9, 2012 at 4:22 PM, Francesco Rodriguez lrodriguezs...@gmail.com wrote: What about initialize_dup? What about it? -f El jul 9, 2012 2:11 p.m., Nicolas Sanguinetti godf...@gmail.com escribió: dup doesn't take arguments because in ruby dup doesn't take arguments. It wouldn't