Ruby on Rails Thursday, November 5, 2015


I was reading some ruby one liners. The rescue style seems to make it easy to write short pieces of code, but it feels like I am forcing an error and then just ignoring it in some cases. I guess I am an older programmer and was never encouraged to write this sort of code, but do most people feel like this is good style ?

def receipt_available
   quote_responses.count > 0 && rqstate.eql?("submitted") rescue false
end

obviously if  code had alot of possible errors to recover from you wouldn't do that

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/d9c52162-6942-4f29-a2f1-2287af28ae8b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment