Class: ActionsController
- Inherits:
-
ArtfullyOseController
- Object
- ActionController::Base
- ArtfullyOseController
- ActionsController
- Defined in:
- app/controllers/actions_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
new and edit don’t exist here, explicitly enforcing that actions can’t be just created by a user they need to be applied to something (a person, search results, a list segment).
- #destroy ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
new and edit don’t exist here, explicitly enforcing that actions can’t be just created by a user they need to be applied to something (a person, search results, a list segment)
13 14 15 16 |
# File 'app/controllers/actions_controller.rb', line 13 def create return apply_to_person if params_person_id return apply_to_search if params[:search_id] || params[:segment_id] end |
#destroy ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/controllers/actions_controller.rb', line 34 def destroy @person = Person.find params_person_id @action = @person.actions.find params[:id] if @action.destroyable? @action.destroy else flash[:notice] = "You can't delete that type of action." end redirect_to_person(@person) end |
#update ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/controllers/actions_controller.rb', line 18 def update @person = Person.find params_person_id @action = Action.find params[:id] @action.set_params(params[:artfully_action], @person) if @action.valid? && @action.save! flash[:notice] = "Action has been logged" redirect_to_person(@person) else flash[:alert] = "There was a problem editing your action, please contact support if the problem persists." redirect_to :back end end |