upgraded to rails

This commit is contained in:
ablwr
2014-08-03 21:43:33 -04:00
parent 5366626046
commit 181c4340f7
82 changed files with 3760 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
end

View File

View File

@@ -0,0 +1,74 @@
class FormsController < ApplicationController
before_action :set_form, only: [:show, :edit, :update, :destroy]
# GET /forms
# GET /forms.json
def index
@forms = Form.all
end
# GET /forms/1
# GET /forms/1.json
def show
end
# GET /forms/new
def new
@form = Form.new
end
# GET /forms/1/edit
def edit
end
# POST /forms
# POST /forms.json
def create
@form = Form.new(form_params)
respond_to do |format|
if @form.save
format.html { redirect_to @form, notice: 'Form was successfully created.' }
format.json { render :show, status: :created, location: @form }
else
format.html { render :new }
format.json { render json: @form.errors, status: :unprocessable_entity }
end
end
end
# PATCH/PUT /forms/1
# PATCH/PUT /forms/1.json
def update
respond_to do |format|
if @form.update(form_params)
format.html { redirect_to @form, notice: 'Form was successfully updated.' }
format.json { render :show, status: :ok, location: @form }
else
format.html { render :edit }
format.json { render json: @form.errors, status: :unprocessable_entity }
end
end
end
# DELETE /forms/1
# DELETE /forms/1.json
def destroy
@form.destroy
respond_to do |format|
format.html { redirect_to forms_url, notice: 'Form was successfully destroyed.' }
format.json { head :no_content }
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_form
@form = Form.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def form_params
params[:form]
end
end