Re: [Rails-core] attr_accessible on some properties + attr_protected on others makes class 'open-by-default'

2012-07-10 Thread Xavier Noria
Sometimes you have a table with a bunch of regular data and one single FK to protect. I don't think forcing users to whitelist that model is a good idea. I prefer Rails to provide both options (three if you count declaring nothing) and leave the judgement of what's appropriate in every situation

Re: [Rails-core] attr_accessible on some properties + attr_protected on others makes class 'open-by-default'

2012-07-10 Thread Michael Breen
I'd like to see attr_protected stick around. There are times I'm working with models and I don't want to communicate the15 fields that can be written to but rather the two fields that can't. Best. Mike On Jul 10, 2012, at 1:45 AM, Ryan Bigg radarliste...@gmail.com wrote: For the record: I

[Rails-core] Re: attr_accessible on some properties + attr_protected on others makes class 'open-by-default'

2012-07-10 Thread Jay Feldblum
In this type of case, it makes sense either to declare a whitelist or to declare a blacklist. But it doesn't make much sense to declare both of them. Solution #3: ActiveRecord (or ActiveModel) should raise if a class declares both a whitelist and a blacklist of mass-assignable attributes.

Re: [Rails-core] Re: attr_accessible on some properties + attr_protected on others makes class 'open-by-default'

2012-07-10 Thread Rafael Mendonça França
Jay, this solution doesn't play nice with inheritance. Rafael Mendonça França http://twitter.com/rafaelfranca https://github.com/rafaelfranca On Tue, Jul 10, 2012 at 10:59 AM, Jay Feldblum yfeldb...@gmail.com wrote: In this type of case, it makes sense either to declare a whitelist or to

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

Re: [Rails-core] attr_accessible on some properties + attr_protected on others makes class 'open-by-default'

2012-07-10 Thread Prem Sichanugrist
Yeah, Jay. Your solution won't work with inheritance. By deprecating the attr_protected, you can allow most of the attributes anyway (but seriously seriously seriously discouraged) by do something like: attr_accessible columns - [:created_at, :updated_at] Having attr_accessible and

Re: [Rails-core] attr_accessible on some properties + attr_protected on others makes class 'open-by-default'

2012-07-10 Thread Jay Feldblum
Prem, What's the conflict with inheritance? Cheers, Jay On Tue, Jul 10, 2012 at 12:29 PM, Prem Sichanugrist sikand...@gmail.comwrote: Yeah, Jay. Your solution won't work with inheritance. By deprecating the attr_protected, you can allow most of the attributes anyway (but seriously

Re: [Rails-core] attr_accessible on some properties + attr_protected on others makes class 'open-by-default'

2012-07-10 Thread Matt Jones
On Jul 10, 2012, at 12:29 PM, Prem Sichanugrist wrote: Yeah, Jay. Your solution won't work with inheritance. By deprecating the attr_protected, you can allow most of the attributes anyway (but seriously seriously seriously discouraged) by do something like: attr_accessible columns -

Re: [Rails-core] Re: Defining #blank for Array.

2012-07-10 Thread Michael Boutros
Do you think anyone currently uses #blank? on enumerables in its current state? It doesn't make sense the way it is right now. Imagine a piece of paper with a list of 10 blank lines. Wouldn't you call that a blank list? On Monday, July 9, 2012 10:50:34 AM UTC-4, Xavier Noria wrote: On Mon,

Re: [Rails-core] Re: Defining #blank for Array.

2012-07-10 Thread James Coleman
I don't think that blank? makes sense on anything other than String, no matter how you define it. My vote would be to deprecate it on Enumerable, for example, and add something else if desired. James Coleman -- Forwarded message -- From: Michael Boutros michael.bout...@gmail.com

Re: [Rails-core] Re: Defining #blank for Array.

2012-07-10 Thread Andrés Mejía
I use it. It makes total sense to me. If you have a piece of paper with a list of 10 blank lines, how do you know there are exactly 10 blank lines instead of 3 or 7 or 13? On Tue, Jul 10, 2012 at 1:55 PM, Michael Boutros michael.bout...@gmail.comwrote: Do you think anyone currently uses

Re: [Rails-core] Re: Defining #blank for Array.

2012-07-10 Thread Rafael Mendonça França
Yes, I think everyone uses #blank? on enumerables in its current state, and expect that behavior, because it is well documented. Rafael Mendonça França http://twitter.com/rafaelfranca https://github.com/rafaelfranca On Tue, Jul 10, 2012 at 3:55 PM, Michael Boutros