Sha256: 0bb29de918d274b911e8bcd6332a48d6bb329b53d4b9186ca45e88a4a6b80600

Contents?: true

Size: 1.69 KB

Versions: 32

Compression:

Stored size: 1.69 KB

Contents

class StarsController < ApplicationController
  before_action :set_star, only: [:show, :edit, :update, :destroy]

  # GET /stars
  # GET /stars.json
  def index
    @stars = Star.all
  end

  # GET /stars/1
  # GET /stars/1.json
  def show
  end

  # GET /stars/new
  def new
    @star = Star.new
  end

  # GET /stars/1/edit
  def edit
  end

  # POST /stars
  # POST /stars.json
  def create
    @star = Star.new(star_params)

    respond_to do |format|
      if @star.save
        format.html { redirect_to @star, notice: 'Star was successfully created.' }
        format.json { render action: 'show', status: :created, location: @star }
      else
        format.html { render action: 'new' }
        format.json { render json: @star.errors, status: :unprocessable_entity }
      end
    end
  end

  # PATCH/PUT /stars/1
  # PATCH/PUT /stars/1.json
  def update
    respond_to do |format|
      if @star.update(star_params)
        format.html { redirect_to @star, notice: 'Star was successfully updated.' }
        format.json { head :no_content }
      else
        format.html { render action: 'edit' }
        format.json { render json: @star.errors, status: :unprocessable_entity }
      end
    end
  end

  # DELETE /stars/1
  # DELETE /stars/1.json
  def destroy
    @star.destroy
    respond_to do |format|
      format.html { redirect_to stars_url }
      format.json { head :no_content }
    end
  end

  private
    # Use callbacks to share common setup or constraints between actions.
    def set_star
      @star = Star.find(params[:id])
    end

    # Never trust parameters from the scary internet, only allow the white list through.
    def star_params
      params.require(:star).permit(:name)
    end
end

Version data entries

32 entries across 7 versions & 1 rubygems

Version Path
tabulous-2.1.4 spec/applications/custom_renderer/rails_4-0-5/app/controllers/stars_controller.rb
tabulous-2.1.4 spec/applications/bootstrap/rails_4-0-5/app/controllers/stars_controller.rb
tabulous-2.1.4 spec/applications/subtabs/rails_4-0-5/app/controllers/stars_controller.rb
tabulous-2.1.4 spec/applications/simple_tabs/rails_4-0-5/app/controllers/stars_controller.rb
tabulous-2.1.4 spec/applications/main/rails_4-0-5/app/controllers/stars_controller.rb
tabulous-2.1.3 spec/applications/bootstrap/rails_4-0-5/app/controllers/stars_controller.rb
tabulous-2.1.3 spec/applications/subtabs/rails_4-0-5/app/controllers/stars_controller.rb
tabulous-2.1.3 spec/applications/simple_tabs/rails_4-0-5/app/controllers/stars_controller.rb
tabulous-2.1.3 spec/applications/main/rails_4-0-5/app/controllers/stars_controller.rb
tabulous-2.1.3 spec/applications/custom_renderer/rails_4-0-5/app/controllers/stars_controller.rb
tabulous-2.1.2 spec/applications/main/rails_4-0-5/app/controllers/stars_controller.rb
tabulous-2.1.2 spec/applications/simple_tabs/rails_4-0-5/app/controllers/stars_controller.rb
tabulous-2.1.2 spec/applications/bootstrap/rails_4-0-5/app/controllers/stars_controller.rb
tabulous-2.1.2 spec/applications/custom_renderer/rails_4-0-5/app/controllers/stars_controller.rb
tabulous-2.1.2 spec/applications/subtabs/rails_4-0-5/app/controllers/stars_controller.rb
tabulous-2.1.1 spec/applications/subtabs/rails_4-0-5/app/controllers/stars_controller.rb
tabulous-2.1.1 spec/applications/bootstrap/rails_4-0-5/app/controllers/stars_controller.rb
tabulous-2.1.1 spec/applications/custom_renderer/rails_4-0-5/app/controllers/stars_controller.rb
tabulous-2.1.1 spec/applications/main/rails_4-0-5/app/controllers/stars_controller.rb
tabulous-2.1.1 spec/applications/simple_tabs/rails_4-0-5/app/controllers/stars_controller.rb