Hi folks,
Just meddling with Rails at the moment, and struggling to figure out how to escape "you have a nil object when you didn't expect it" errors . At the moment I'm escaping each of them with an "unless object.nil?" message, but it's getting pretty ugly. Case in point:
unless params[:professiontypeinfo].nil?
unless params[:professiontypeinfo][professiontypeid].nil?
unless params[:professiontypeinfo][professiontypeid]["industrybodies"].nil?
@professional.professional_specialties.find_by_profession_type_id(professiontypeid).industry_bodies = IndustryBody.find_all_by_id(params[:professiontypeinfo][professiontypeid]["industrybodies"])
end
end
end
Soo...what's the correct/graceful way of escaping these things?