app/controllers/services_controller.rb
# find_by_id wont error out and is just nil if it cant find it
find_by_id wont error out and is just nil if it cant find it
find_by_id wont error out and is just nil if it cant find it
def new
    @ai = Ai.find_by_id(params[:ai_id])
    if params[:ai_id] && ai = Ai.find_by_id(params[:ai_id])
      @service = ai.services.build
    else
      @service = Service.new
    end
  end
def new @ai = Ai . find_by_id ( params [ :ai_id ] ) if params [ :ai_id ] && ai = Ai . find_by_id ( params [ :ai_id ] ) @service = ai . services . build else @service = Service . new end end
find_by_id wont error out and is just nil if it cant find it
find_by_id wont error out and is just nil if it cant find it
#raise @ai.inspect # check if its nested & it's a proper id # nested route #unnested