Which is the preferred way to determine if a chained call is nil? i.e:
company.andand.namecompany.try(:name)return nil if company.nil?; company.name(company or return nil).name
For the last one, you must use the predicate or rather than || to make the return work correctly.
tryis also slightly different in Rails 3 and 4. I'll try and find out why unless someone knows...