I noticed that [8863] remove the :except and :only options from ActiveRecord::Base#attributes (and it makes perfect since not to duplicate Hash#except/slice in there). #attributes still takes an options parameter, but just ignores it, which could lead to a tricky to diagnose error further down the line. Could a deprecation notice not be issued (or make attributes not take an options parameter to that ArgumentError is raised if people try) to make this easier to spot? Fred --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
On L, 2008-04-26 at 13:10 +0100, Frederick Cheung wrote:> I noticed that [8863] remove the :except and :only options from > ActiveRecord::Base#attributes (and it makes perfect since not to > duplicate Hash#except/slice in there). #attributes still takes an > options parameter, but just ignores it, which could lead to a tricky > to diagnose error further down the line. Could a deprecation notice > not be issued (or make attributes not take an options parameter to > that ArgumentError is raised if people try) to make this easier to spot?I pointed this issue out in #rails-core but noone responded. The strip_attributes[1] plugin is the only place I''ve seen using this feature; with [8863] the plugin would actually misbehave silently (stripping all attributes). I think the option should be removed, and an appropriate upgrade strategy described in the release notes. An alternative would be to do something like this: def attributes(options=nil) if options raise ArgumentError, ''The options argument is no longer accepted, please use Hash#except or Hash#slice'' .. But I''d prefer the fiest approach as the simple fact that the feature was removed suggests that it is not commonly used and as such does not need special attention. [1] http://rubyforge.org/projects/stripattributes --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
On 26 Apr 2008, at 14:48, Tarmo Tänav wrote:> > On L, 2008-04-26 at 13:10 +0100, Frederick Cheung wrote: >> I noticed that [8863] remove the :except and :only options from >> ActiveRecord::Base#attributes (and it makes perfect since not to >> duplicate Hash#except/slice in there). #attributes still takes an >> options parameter, but just ignores it, which could lead to a tricky >> to diagnose error further down the line. Could a deprecation notice >> not be issued (or make attributes not take an options parameter to >> that ArgumentError is raised if people try) to make this easier to >> spot? > > I pointed this issue out in #rails-core but noone responded. > > The strip_attributes[1] plugin is the only place I''ve seen using > this feature; with [8863] the plugin would actually misbehave > silently (stripping all attributes). >It''s the silent stuff which is bad. Spent a good 15 minutes scratching my head while trying out one of my apps> I think the option should be removed, and an appropriate upgrade > strategy described in the release notes.Sounds like a plan to me. I''m happy to knock up the (completely trivial) patch. Fred> An alternative would be to do something like this: > def attributes(options=nil) > if options > raise ArgumentError, ''The options argument is no longer accepted, > please use Hash#except or Hash#slice'' > .. > But I''d prefer the fiest approach as the simple fact that > the feature was removed suggests that it is not commonly used > and as such does not need special attention.yes, perhaps a little over the top.> > [1] http://rubyforge.org/projects/stripattributes > > > >--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
> Sounds like a plan to me. I''m happy to knock up the (completely > trivial) patch.Sounds great, we should also add a deprecation warning to 2-0-stable, care to whip up both patches? ;) -- Cheers Koz --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
On 26 Apr 2008, at 23:27, Michael Koziarski wrote:> >> Sounds like a plan to me. I''m happy to knock up the (completely >> trivial) patch. > > Sounds great, we should also add a deprecation warning to 2-0-stable, > care to whip up both patches? ;) >http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/52-remove-argument-from-base-attributes-deprecate#ticket-52-1 Fred --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---