/
techgrant
/
ourresource
Обзор
Документация
Войти
/
techgrant
/
ourresource
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
app/controllers/procedures_controller.rb
84 строки
2 KB
grant88
asdf
17 янв 2013, 02:23
17 янв 2013, 02:23
42e28ca
Код
Авторство
О чём код?
class ProceduresController < ApplicationController # GET /procedures # GET /procedures.json before_filter :check_login def index @procedures = Procedure.all respond_to do |format| format.html # index.html.erb format.json { render json: @procedures } end end # GET /procedures/1 # GET /procedures/1.json def show @procedure = Procedure.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @procedure } end end # GET /procedures/new # GET /procedures/new.json def new @procedure = Procedure.new respond_to do |format| format.html # new.html.erb format.json { render json: @procedure } end end # GET /procedures/1/edit def edit @procedure = Procedure.find(params[:id]) end # POST /procedures # POST /procedures.json def create @procedure = Procedure.new(params[:procedure]) respond_to do |format| if @procedure.save format.html { redirect_to @procedure, notice: 'Procedure was successfully created.' } format.json { render json: @procedure, status: :created, location: @procedure } else format.html { render action: "new" } format.json { render json: @procedure.errors, status: :unprocessable_entity } end end end # PUT /procedures/1 # PUT /procedures/1.json def update @procedure = Procedure.find(params[:id]) respond_to do |format| if @procedure.update_attributes(params[:procedure]) format.html { redirect_to @procedure, notice: 'Procedure was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @procedure.errors, status: :unprocessable_entity } end end end # DELETE /procedures/1 # DELETE /procedures/1.json def destroy @procedure = Procedure.find(params[:id]) @procedure.destroy respond_to do |format| format.html { redirect_to procedures_url } format.json { head :no_content } end end end