Class: FinePrint::ContractsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- FinePrint::ContractsController
- Includes:
- ApplicationHelper
- Defined in:
- app/controllers/fine_print/contracts_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #new_version ⇒ Object
- #publish ⇒ Object
- #show ⇒ Object
- #unpublish ⇒ Object
- #update ⇒ Object
Methods included from ApplicationHelper
Instance Method Details
#create ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/controllers/fine_print/contracts_controller.rb', line 20 def create @contract = Contract.new @contract.name = params[:contract][:name] @contract.title = params[:contract][:title] @contract.content = params[:contract][:content] if @contract.save redirect_to @contract, :notice => 'Contract was successfully created.' else render :action => 'new' end end |
#destroy ⇒ Object
45 46 47 48 49 50 51 |
# File 'app/controllers/fine_print/contracts_controller.rb', line 45 def destroy if @contract.destroy redirect_to contracts_path, :notice => 'Contract was successfully deleted.' else redirect_to contracts_path, :alert => merge_errors_for(@contract) end end |
#edit ⇒ Object
17 18 |
# File 'app/controllers/fine_print/contracts_controller.rb', line 17 def edit end |
#index ⇒ Object
6 7 8 |
# File 'app/controllers/fine_print/contracts_controller.rb', line 6 def index @contracts = Contract.all end |
#new ⇒ Object
13 14 15 |
# File 'app/controllers/fine_print/contracts_controller.rb', line 13 def new @contract = Contract.new end |
#new_version ⇒ Object
69 70 71 |
# File 'app/controllers/fine_print/contracts_controller.rb', line 69 def new_version @contract = @contract.draft_copy end |
#publish ⇒ Object
53 54 55 56 57 58 59 |
# File 'app/controllers/fine_print/contracts_controller.rb', line 53 def publish if @contract.publish redirect_to contracts_path, :notice => 'Contract was successfully published.' else redirect_to contracts_path, :alert => merge_errors_for(@contract) end end |
#show ⇒ Object
10 11 |
# File 'app/controllers/fine_print/contracts_controller.rb', line 10 def show end |
#unpublish ⇒ Object
61 62 63 64 65 66 67 |
# File 'app/controllers/fine_print/contracts_controller.rb', line 61 def unpublish if @contract.unpublish redirect_to contracts_path, :notice => 'Contract was successfully unpublished.' else redirect_to contracts_path, :alert => merge_errors_for(@contract) end end |
#update ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 |
# File 'app/controllers/fine_print/contracts_controller.rb', line 33 def update @contract.name = params[:contract][:name] @contract.title = params[:contract][:title] @contract.content = params[:contract][:content] if @contract.save redirect_to @contract, :notice => 'Contract was successfully updated.' else render :action => 'edit' end end |