Just interfering with Rails at the moment, and struggling to figure out how to avoid "you have a null object when you did not expect this." At the moment I am running away from each of them with "if object.nil?" message, but it gets pretty ugly. Example:
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
Su ... what is the right / elegant way to avoid these things?
source
share