Skip to content

Instantly share code, notes, and snippets.

@ahoward
Created December 11, 2008 18:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahoward/34823 to your computer and use it in GitHub Desktop.
Save ahoward/34823 to your computer and use it in GitHub Desktop.
def lettuce_report
allows :student, :studentdemo
setup_for_student
@report = @unit.find_lettuce_seed_bioassay_report(:student => @student)
@questionnaire = @report.questionnaire
@questions_and_answers = @student.questions_and_answers_for(@questionnaire, :context => @classroom, :blank => true)
if request.post?
transaction do
@questions_and_answers.update_with_params params
@questions_and_answers.save!
@report.save!
if submitting?
@questions_and_answers.submit!
@report.submit!
end
end
if submitting?
message 'Thanks, your report has been submitted!', :class => 'success'
else
message 'Thanks, your report has been saved!', :class => 'success'
end
qq_redirect_to :action => 'index' and return
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment