Class: Cfp::ProposalsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Cfp::ProposalsController
- Defined in:
- app/controllers/cfp/proposals_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'app/controllers/cfp/proposals_controller.rb', line 15 def create @proposal = Proposal.new proposal_params[:proposal] @proposal.user = current_user if @proposal.save redirect_to :proposals, :notice => t('proposals.created.success') else render :action => :new end end |
#destroy ⇒ Object
36 37 38 39 |
# File 'app/controllers/cfp/proposals_controller.rb', line 36 def destroy @proposal.destroy if @proposal.can_be_edited_by?(current_user) redirect_to :proposals, :notice => t('proposals.deleted.success') end |
#edit ⇒ Object
25 26 |
# File 'app/controllers/cfp/proposals_controller.rb', line 25 def edit end |
#index ⇒ Object
7 8 9 |
# File 'app/controllers/cfp/proposals_controller.rb', line 7 def index @proposals = Proposal.scoped_for(current_user) end |
#new ⇒ Object
11 12 13 |
# File 'app/controllers/cfp/proposals_controller.rb', line 11 def new @proposal = Proposal.new end |
#update ⇒ Object
28 29 30 31 32 33 34 |
# File 'app/controllers/cfp/proposals_controller.rb', line 28 def update if @proposal.can_be_edited_by?(current_user) && @proposal.update_attributes(proposal_params[:proposal]) redirect_to :proposals, :notice => t('proposals.edited.success') else render :action => "edit" end end |