tack2us/app/controllers/pastes_controller.rb

40 lines
592 B
Ruby
Raw Permalink Normal View History

class PastesController < ApplicationController
def index
2014-02-14 15:54:22 -05:00
@pastes = Paste.all
end
2014-02-14 15:54:22 -05:00
def show
@paste = Paste.find(params[:id])
end
def new
2014-02-14 15:54:22 -05:00
@paste = Paste.new
end
2014-02-14 15:54:22 -05:00
def edit
end
2014-02-14 15:54:22 -05:00
def create
@paste = Paste.new(paste_params)
if @paste.save
flash[:success] = "Your paste has been added"
redirect_to @paste
else
flash.now[:danger] = "There was an error submitting your form"
render 'new'
end
end
def update
end
def destroy
end
2014-02-14 15:54:22 -05:00
private
def paste_params
params.require(:paste).permit(:content)
end
end