rqstate is as follows, if there is not a quote request or the status field 
is null then we could assume
that the request was never submitted to the backend api. This was actually 
the first time I tried this approach but I am not sure I will keep it this 
way

def rqstate
   self.quote_request.status rescue "unsubmitted"
end


I got the idea from other uses and #21 here:
http://www.rubyinside.com/21-ruby-tricks-902.html

 I get the point that you are suppressing possible errors, however it seems 
you could avoid using rescue in many places where it is used. 

What if the language made it so you could use that type of syntax and when 
an error occurred you could handle it someplace else, in effect defining 
some action for the rescue or is that possible ? 

I first took notice of this:

http://stackoverflow.com/questions/800122/best-way-to-convert-strings-to-symbols-in-hash

myhash.keys.each do |key|
  myhash[(key.to_sym rescue key) || key] = myhash.delete(key)end


I don't quite get why it is not just

myhash[key.to_sym rescue key] = myhash.delete(key)



-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/702397a2-6f12-4b50-b041-b53581bf9ea8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to