I suggest deprecating the .delete method. Since it bypasses the callbacks and dependent destroys, it can really mislead beginning users. Or a possible fix would be renaming it to a less friendly name that would be used. I see programmers that come over from other languages assuming this is the traditional syntax for a common way to remove an record. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscribe@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at http://groups.google.com/group/rubyonrails-core?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
I don''t think we should do anything with this method. The documentation is clear about how it works. Deletes the record in the database and freezes this instance to reflect that no changes should be made (since they can’t be persisted). Returns the frozen instance. The row is simply removed with an SQL DELETE statement on the record’s primary key, and no callbacks are executed. To enforce the object’s before_destroy and after_destroy callbacks or any :dependent association options, use #destroy Rafael Mendonça França http://twitter.com/rafaelfranca https://github.com/rafaelfranca On Wed, Feb 6, 2013 at 1:19 PM, Benjamin Niemietz < bniemietz@enfocussolutions.com> wrote:> I suggest deprecating the .delete method. Since it bypasses the callbacks > and dependent destroys, it can really mislead beginning users. Or a > possible fix would be renaming it to a less friendly name that would be > used. I see programmers that come over from other languages assuming this > is the traditional syntax for a common way to remove an record. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-core+unsubscribe@googlegroups.com. > To post to this group, send email to rubyonrails-core@googlegroups.com. > Visit this group at http://groups.google.com/group/rubyonrails-core?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscribe@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at http://groups.google.com/group/rubyonrails-core?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Yeah, -1 on the deprecation as well. On Wednesday, February 6, 2013 at 11:34 AM, Rafael Mendonça França wrote:> I don''t think we should do anything with this method. The documentation is clear about how it works. > > > > > Deletes the record in the database and freezes this instance to reflect that no changes should be made (since they can’t be persisted). Returns the frozen instance. > > > The row is simply removed with an SQL DELETE statement on the record’s primary key, and no callbacks are executed. > > > To enforce the object’s before_destroy and after_destroy callbacks or any :dependent association options, use #destroy > > > > > Rafael Mendonça França > http://twitter.com/rafaelfranca > https://github.com/rafaelfranca > > > On Wed, Feb 6, 2013 at 1:19 PM, Benjamin Niemietz <bniemietz@enfocussolutions.com (mailto:bniemietz@enfocussolutions.com)> wrote: > > I suggest deprecating the .delete method. Since it bypasses the callbacks and dependent destroys, it can really mislead beginning users. Or a possible fix would be renaming it to a less friendly name that would be used. I see programmers that come over from other languages assuming this is the traditional syntax for a common way to remove an record. > > > > -- > > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. > > To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscribe@googlegroups.com (mailto:rubyonrails-core%2Bunsubscribe@googlegroups.com). > > To post to this group, send email to rubyonrails-core@googlegroups.com (mailto:rubyonrails-core@googlegroups.com). > > Visit this group at http://groups.google.com/group/rubyonrails-core?hl=en. > > For more options, visit https://groups.google.com/groups/opt_out. > > > > > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. > To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscribe@googlegroups.com (mailto:rubyonrails-core+unsubscribe@googlegroups.com). > To post to this group, send email to rubyonrails-core@googlegroups.com (mailto:rubyonrails-core@googlegroups.com). > Visit this group at http://groups.google.com/group/rubyonrails-core?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscribe@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at http://groups.google.com/group/rubyonrails-core?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
-1; docs are clear On Wed, Feb 6, 2013 at 10:49 AM, Prem Sichanugrist <sikandsak@gmail.com>wrote:> Yeah, -1 on the deprecation as well. > > On Wednesday, February 6, 2013 at 11:34 AM, Rafael Mendonça França wrote: > > I don''t think we should do anything with this method. The documentation is > clear about how it works. > > > > Deletes the record in the database and freezes this instance to reflect > that no changes should be made (since they can’t be persisted). Returns the > frozen instance. > > The row is simply removed with an SQL DELETE statement on the record’s > primary key, and no callbacks are executed. > > To enforce the object’s before_destroy and after_destroy callbacks or any > :dependent association options, use #destroy > > Rafael Mendonça França > http://twitter.com/rafaelfranca > https://github.com/rafaelfranca > > > On Wed, Feb 6, 2013 at 1:19 PM, Benjamin Niemietz < > bniemietz@enfocussolutions.com> wrote: > > I suggest deprecating the .delete method. Since it bypasses the callbacks > and dependent destroys, it can really mislead beginning users. Or a > possible fix would be renaming it to a less friendly name that would be > used. I see programmers that come over from other languages assuming this > is the traditional syntax for a common way to remove an record. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-core+unsubscribe@googlegroups.com. > To post to this group, send email to rubyonrails-core@googlegroups.com. > Visit this group at http://groups.google.com/group/rubyonrails-core?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > > > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-core+unsubscribe@googlegroups.com. > To post to this group, send email to rubyonrails-core@googlegroups.com. > Visit this group at http://groups.google.com/group/rubyonrails-core?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > > > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-core+unsubscribe@googlegroups.com. > To post to this group, send email to rubyonrails-core@googlegroups.com. > Visit this group at http://groups.google.com/group/rubyonrails-core?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscribe@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at http://groups.google.com/group/rubyonrails-core?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
RTFM. Really, you shouldn''t ever just assume what methods do based on their names. Em 06-02-2013 13:19, Benjamin Niemietz escreveu:> I suggest deprecating the .delete method. Since it bypasses the > callbacks and dependent destroys, it can really mislead beginning > users. Or a possible fix would be renaming it to a less friendly name > that would be used. I see programmers that come over from other > languages assuming this is the traditional syntax for a common way to > remove an record. -- > You received this message because you are subscribed to the Google > Groups "Ruby on Rails: Core" group. > To unsubscribe from this group and stop receiving emails from it, send > an email to rubyonrails-core+unsubscribe@googlegroups.com. > To post to this group, send email to rubyonrails-core@googlegroups.com. > Visit this group at http://groups.google.com/group/rubyonrails-core?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscribe@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at http://groups.google.com/group/rubyonrails-core?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
I always thought the method names *were* obvious. ''delete'' does exactly what it says it does. The callbacks/hooks are named :before_destroy, :dependent => :destroy, etc. They all reference ''destroy'' for a reason. On Wednesday, February 6, 2013, Rodrigo Rosenfeld Rosas wrote:> RTFM. Really, you shouldn''t ever just assume what methods do based on > their names. > > Em 06-02-2013 13:19, Benjamin Niemietz escreveu: > >> I suggest deprecating the .delete method. Since it bypasses the callbacks >> and dependent destroys, it can really mislead beginning users. Or a >> possible fix would be renaming it to a less friendly name that would be >> used. I see programmers that come over from other languages assuming this >> is the traditional syntax for a common way to remove an record. -- >> You received this message because you are subscribed to the Google Groups >> "Ruby on Rails: Core" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to rubyonrails-core+unsubscribe@googlegroups.com. >> To post to this group, send email to rubyonrails-core@googlegroups.com. >> Visit this group at http://groups.google.com/** >> group/rubyonrails-core?hl=en<http://groups.google.com/group/rubyonrails-core?hl=en> >> . >> For more options, visit https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out> >> . >> >> >> > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-core+unsubscribe@googlegroups.com. > To post to this group, send email to rubyonrails-core@googlegroups.com. > Visit this group at http://groups.google.com/** > group/rubyonrails-core?hl=en<http://groups.google.com/group/rubyonrails-core?hl=en> > . > For more options, visit https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out> > . > > >-- -- Jarrett Meyer Email: jarrettmeyer@gmail.com Web: JarrettMeyer.com <http://jarrettmeyer.com> Twitter: @jarrettmeyer <http://twitter.com/jarrettmeyer> -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscribe@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at http://groups.google.com/group/rubyonrails-core?hl=en. For more options, visit https://groups.google.com/groups/opt_out.