Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
class WorksController < ApplicationController
# GET /works
def index
@works = Work.all
@uploader = Work.new.image
@uploader.success_action_redirect = new_work_url
respond_to do |format|
format.html # index.html.erb
end
end
# GET /works/1
def show
@work = Work.find(params[:id])
respond_to do |format|
format.html # show.html.erb
end
end
# GET /works/new
def new
@work = Work.new(key: params[:key])
respond_to do |format|
format.html # new.html.erb
end
end
# GET /works/1/edit
def edit
@work = Work.find(params[:id])
end
# POST /works
def create
@work = Work.new(params[:work])
respond_to do |format|
if @work.save
format.html { redirect_to @work, notice: 'Work was successfully created.' }
else
format.html { render action: "new" }
end
end
end
# PUT /works/1
def update
@work = Work.find(params[:id])
respond_to do |format|
if @work.update_attributes(params[:work])
format.html { redirect_to @work, notice: 'Work was successfully updated.' }
else
format.html { render action: "edit" }
end
end
end
# DELETE /works/1
def destroy
@work = Work.find(params[:id])
@work.destroy
respond_to do |format|
format.html { redirect_to works_url }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.