Adding contracts

This commit is contained in:
2014-02-27 04:13:53 -07:00
parent 095b6d3965
commit c74da562bc
8 changed files with 198 additions and 1 deletions

View File

@@ -0,0 +1,50 @@
class ContractsController < ApplicationController
load_and_authorize_resource :contract
before_filter :authenticate_user!
layout 'resources'
def index
end
def show
end
def new
end
def edit
end
def create
respond_to do |format|
if @contract.save
format.html { redirect_to Contract, :notice => 'Contract was successfully created.' }
format.json { render :json => @contract, :status => :created, :location => @contract }
else
format.html { render :action => "new" }
format.json { render :json => @contract.errors, :status => :unprocessable_entity }
end
end
end
def update
respond_to do |format|
if @contract.update_attributes(params[:contract])
format.html { redirect_to Contract, :notice => 'Contract was successfully updated.' }
format.json { head :no_content }
else
format.html { render :action => "edit" }
format.json { render :json => @contract.errors, :status => :unprocessable_entity }
end
end
end
def destroy
@contract.destroy
respond_to do |format|
format.html { redirect_to contracts_url }
format.json { head :no_content }
end
end
end