Sha256: 20e50cc14c2d89cfb9e45627a18785392e64bb65c67adb9c0bea65176a4b1c73

Contents?: true

Size: 1.82 KB

Versions: 32

Compression:

Stored size: 1.82 KB

Contents

class GalaxiesController < ApplicationController
  before_action :set_galaxy, only: [:show, :edit, :update, :destroy]

  # GET /galaxies
  # GET /galaxies.json
  def index
    @galaxies = Galaxy.all
  end

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

  # GET /galaxies/new
  def new
    @galaxy = Galaxy.new
  end

  # GET /galaxies/1/edit
  def edit
  end

  # POST /galaxies
  # POST /galaxies.json
  def create
    @galaxy = Galaxy.new(galaxy_params)

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

  # PATCH/PUT /galaxies/1
  # PATCH/PUT /galaxies/1.json
  def update
    respond_to do |format|
      if @galaxy.update(galaxy_params)
        format.html { redirect_to @galaxy, notice: 'Galaxy was successfully updated.' }
        format.json { render :show, status: :ok, location: @galaxy }
      else
        format.html { render :edit }
        format.json { render json: @galaxy.errors, status: :unprocessable_entity }
      end
    end
  end

  # DELETE /galaxies/1
  # DELETE /galaxies/1.json
  def destroy
    @galaxy.destroy
    respond_to do |format|
      format.html { redirect_to galaxies_url, notice: 'Galaxy was successfully destroyed.' }
      format.json { head :no_content }
    end
  end

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

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

Version data entries

32 entries across 4 versions & 1 rubygems

Version Path
tabulous-2.1.2 spec/applications/bootstrap/rails_4-1-1/app/controllers/galaxies_controller.rb
tabulous-2.1.2 spec/applications/simple_tabs/rails_4-2-0/app/controllers/galaxies_controller.rb
tabulous-2.1.2 spec/applications/simple_tabs/rails_4-1-1/app/controllers/galaxies_controller.rb
tabulous-2.1.2 spec/applications/main/rails_4-2-0/app/controllers/galaxies_controller.rb
tabulous-2.1.2 spec/applications/main/rails_4-1-1/app/controllers/galaxies_controller.rb
tabulous-2.1.2 spec/applications/custom_renderer/rails_4-2-0/app/controllers/galaxies_controller.rb
tabulous-2.1.2 spec/applications/custom_renderer/rails_4-1-1/app/controllers/galaxies_controller.rb
tabulous-2.1.2 spec/applications/bootstrap/rails_4-2-0/app/controllers/galaxies_controller.rb
tabulous-2.1.1 spec/applications/custom_renderer/rails_4-1-1/app/controllers/galaxies_controller.rb
tabulous-2.1.1 spec/applications/simple_tabs/rails_4-1-1/app/controllers/galaxies_controller.rb
tabulous-2.1.1 spec/applications/main/rails_4-1-1/app/controllers/galaxies_controller.rb
tabulous-2.1.1 spec/applications/bootstrap/rails_4-1-1/app/controllers/galaxies_controller.rb