次の After Filters があります。
ユーザー モデル:
def check_for_custom_district
unless self.custom_district.blank?
district = District.new(:name => custom_district, :state_id => state_id, :school_type_id => school_type_id)
if district.save(false)
school = School.new(:name => custom_school, :state_id => state_id, :country_id => 1, :source => "User")
if school.save(false)
district.schools << school
update_attribute(:school_id, school.id)
end
end
end
end
def check_for_custom_school
if self.custom_district.blank? and self.custom_school.present?
school = School.new(:name => custom_school, :state_id => state_id, :country_id => 1, :source => "User", :school_district_id => district_id)
school.save(false)
update_attribute(:school_id, school.id)
end
end
結果をコンソールに出力するためにデバッグを実行しましたが、コードがcheck_for_custom_district
メソッドにヒットし、何らかの理由で無限ループが発生しています。これを止める方法がわからない...何かアイデアはありますか?