ruby - How can i delete from list while using ransack search in rails -
i trying delete list when trying getting deleted database
@course = course.find(params[:id]) @search = lesson.search(params[:q]) @lessons = @search.result.paginate(:page => params[:page], :per_page => 10) @search.build_condition if @search.conditions.empty? @course.lessons.each |lesson| @lessons.each |l| if lesson.id == l.id @lessons.delete(l) end end end
i getting error: delete_all doesn't support limit scope thanking you
delete activerecord method. assume don't want delete database result list. can this:
@course.lessons.each |lesson| @lesson.reject { |l| l.id == lesson.id } end
Comments
Post a Comment