Sha256: 20f32d045868f4e014956dfc89bd51d909273cf62a9f5999f11859e70dc4e1c8
Contents?: true
Size: 1.99 KB
Versions: 1
Compression:
Stored size: 1.99 KB
Contents
class ApplicationsController < ApplicationController before_action :set_application, only: [:show, :edit, :update, :destroy] # GET /applications # GET /applications.json def index @applications = Application.all end # GET /applications/1 # GET /applications/1.json def show end # GET /applications/new def new @application = Application.new end # GET /applications/1/edit def edit end # POST /applications # POST /applications.json def create @application = Application.new(application_params) respond_to do |format| if @application.save format.html { redirect_to @application, notice: 'Application was successfully created.' } format.json { render :show, status: :created, location: @application } else format.html { render :new } format.json { render json: @application.errors, status: :unprocessable_entity } end end end # PATCH/PUT /applications/1 # PATCH/PUT /applications/1.json def update respond_to do |format| if @application.update(application_params) format.html { redirect_to @application, notice: 'Application was successfully updated.' } format.json { render :show, status: :ok, location: @application } else format.html { render :edit } format.json { render json: @application.errors, status: :unprocessable_entity } end end end # DELETE /applications/1 # DELETE /applications/1.json def destroy @application.destroy respond_to do |format| format.html { redirect_to applications_url, notice: 'Application was successfully destroyed.' } format.json { head :no_content } end end private # Use callbacks to share common setup or constraints between actions. def set_application @application = Application.find(params[:id]) end # Never trust parameters from the scary internet, only allow the white list through. def application_params params.fetch(:application, {}) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sandboxy-2.0.0 | examples/rails_example/app/controllers/applications_controller.rb |