class FormSubmissionsController
Public Instance Methods
create()
click to toggle source
POST /form_submissions POST /form_submissions.json
# File lib/generators/install/templates/app/controllers/form_submissions_controller.rb, line 43 def create @form_submission = FormSubmission.new(params[:form_submission]) respond_to do |format| if @form_submission.save format.html { redirect_to @form_submission, notice: 'Form submission was successfully created.' } format.json { render json: @form_submission, status: :created, location: @form_submission } else format.html { render action: "new" } format.json { render json: @form_submission.errors, status: :unprocessable_entity } end end end
destroy()
click to toggle source
DELETE /form_submissions/1 DELETE /form_submissions/1.json
# File lib/generators/install/templates/app/controllers/form_submissions_controller.rb, line 74 def destroy @form_submission = FormSubmission.find(params[:id]) @form_submission.destroy respond_to do |format| format.html { redirect_to form_submissions_url } format.json { head :ok } end end
edit()
click to toggle source
GET /form_submissions/1/edit
# File lib/generators/install/templates/app/controllers/form_submissions_controller.rb, line 37 def edit @form_submission = FormSubmission.find(params[:id]) end
index()
click to toggle source
GET /form_submissions GET /form_submissions.json
# File lib/generators/install/templates/app/controllers/form_submissions_controller.rb, line 4 def index @form = Form.find(params[:form_id]) @form_submissions = FormSubmission.joins(:form_schema).where("form_schemas.form_id = ?", @form.id) respond_to do |format| format.html # index.html.erb format.json { render json: @form_submissions } end end
new()
click to toggle source
GET /form_submissions/new GET /form_submissions/new.json
# File lib/generators/install/templates/app/controllers/form_submissions_controller.rb, line 26 def new @form_submission = FormSubmission.new @form_submission.form_schema_id = Form.find(params[:form_id]).form_schemas.first.id respond_to do |format| format.html # new.html.erb format.json { render json: @form_submission } end end
show()
click to toggle source
GET /form_submissions/1 GET /form_submissions/1.json
# File lib/generators/install/templates/app/controllers/form_submissions_controller.rb, line 16 def show @form_submission = FormSubmission.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @form_submission } end end
update()
click to toggle source
PUT /form_submissions/1 PUT /form_submissions/1.json
# File lib/generators/install/templates/app/controllers/form_submissions_controller.rb, line 58 def update @form_submission = FormSubmission.find(params[:id]) respond_to do |format| if @form_submission.update_attributes(params[:form_submission]) format.html { redirect_to @form_submission, notice: 'Form submission was successfully updated.' } format.json { head :ok } else format.html { render action: "edit" } format.json { render json: @form_submission.errors, status: :unprocessable_entity } end end end