Using exceptions as flow control is an anti-pattern, so I'd prefer to *not *add this.
On Tue, Sep 24, 2013 at 6:51 PM, pathé Sene <[email protected]> wrote: > +1 > > > 2013/9/24 Roman <[email protected]> > >> Hi, >> just stumbled upon a need to raise a NotFound exception when the object >> doesn't have a necessary association. So instead of writing >> `Company.find(current_user.company_id)` or `current_user.company || raise >> AR::RecordNotFound`, maybe it would be nicer to just say >> `current_user.company!`. What do you think? >> >> -- >> 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 [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at http://groups.google.com/group/rubyonrails-core. >> 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 [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/rubyonrails-core. > 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/groups/opt_out.
