Sha256: 863447c62d10a323da33b4649d364a8237b5f0b3fbf7b45edad232d22293ef1e

Contents?: true

Size: 1.9 KB

Versions: 14

Compression:

Stored size: 1.9 KB

Contents

class RecordsController < ApplicationController
  # GET /records
  # GET /records.json
  def index
    @records = Record.all

    respond_to do |format|
      format.html # index.html.erb
      format.json { render json: @records }
    end
  end

  # GET /records/1
  # GET /records/1.json
  def show
    @record = Record.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.json { render json: @record }
    end
  end

  # GET /records/new
  # GET /records/new.json
  def new
    @record = Record.new

    respond_to do |format|
      format.html # new.html.erb
      format.json { render json: @record }
    end
  end

  # GET /records/1/edit
  def edit
    @record = Record.find(params[:id])
  end

  # POST /records
  # POST /records.json
  def create
    @record = Record.new(params[:record])

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

  # PUT /records/1
  # PUT /records/1.json
  def update
    @record = Record.find(params[:id])

    respond_to do |format|
      if @record.update_attributes(params[:record])
        format.html { redirect_to @record, notice: 'Record was successfully updated.' }
        format.json { head :no_content }
      else
        format.html { render action: "edit" }
        format.json { render json: @record.errors, status: :unprocessable_entity }
      end
    end
  end

  # DELETE /records/1
  # DELETE /records/1.json
  def destroy
    @record = Record.find(params[:id])
    @record.destroy

    respond_to do |format|
      format.html { redirect_to records_url }
      format.json { head :no_content }
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
hydra-tutorial-0.2.1 templates/records_controller.rb
hydra-tutorial-0.2.0 templates/records_controller.rb
hydra-tutorial-0.1.3 or_templates/records_controller.rb
hydra-tutorial-0.1.2 or_templates/records_controller.rb
hydra-tutorial-0.1.0 or_templates/records_controller.rb
hydra-tutorial-0.0.9 or_templates/records_controller.rb
hydra-tutorial-0.0.8 or_templates/records_controller.rb
hydra-tutorial-0.0.7 or_templates/records_controller.rb
hydra-tutorial-0.0.6 or_templates/records_controller.rb
hydra-tutorial-0.0.5 or_templates/records_controller.rb
hydra-tutorial-0.0.4 or_templates/records_controller.rb
hydra-tutorial-0.0.3 or_templates/records_controller.rb
hydra-tutorial-0.0.2 or_templates/records_controller.rb
hydra-tutorial-0.0.1 or_templates/records_controller.rb