Sha256: f8da6dc8d0aa9dc3d6666badd59e6a0aaa311ce1f8fdf6389e5d718c40786451

Contents?: true

Size: 909 Bytes

Versions: 5

Compression:

Stored size: 909 Bytes

Contents

class AudiosController < ApplicationController

  respond_to :html

  # GET /audios
  def index
    @audios = Audio.all

    respond_with(@audios)
  end

  # GET /audios/1
  def show
    @audio = Audio.find(params[:id])

    respond_with(@audio)
  end

  # GET /audios/new
  def new
    @audio = Audio.new

    respond_with(@audio)
  end

  # GET /audios/1/edit
  def edit
    @audio = Audio.find(params[:id])
  
    respond_with(@audio)
  end

  # POST /audios
  def create
    @audio = Audio.create(attributes)

    respond_with(@audio)
  end

  # PUT /audios/1
  def update
    @audio = Audio.find(params[:id])
    @audio.attributes = attributes
    @audio.save
  
    respond_with(@audio)
  end

  # DELETE /audios/1
  def destroy
    @audio = Audio.find(params[:id])
    @audio.destroy

    respond_with(@audio)
  end

private

  def attributes
    params.require(:audio).permit(:name, :file)
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
attached-1.0.5 test/dummy/app/controllers/audios_controller.rb
attached-1.0.4 test/dummy/app/controllers/audios_controller.rb
attached-1.0.3 test/dummy/app/controllers/audios_controller.rb
attached-1.0.2 test/dummy/app/controllers/audios_controller.rb
attached-1.0.1 test/dummy/app/controllers/audios_controller.rb