mirror of
https://github.com/amiaopensource/ffmprovisr.git
synced 2025-10-24 06:39:09 +02:00
upgraded to rails
This commit is contained in:
5
app/controllers/application_controller.rb
Normal file
5
app/controllers/application_controller.rb
Normal 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
|
||||
0
app/controllers/concerns/.keep
Normal file
0
app/controllers/concerns/.keep
Normal file
74
app/controllers/forms_controller.rb
Normal file
74
app/controllers/forms_controller.rb
Normal 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
|
||||
Reference in New Issue
Block a user