Class: ActionsController

Inherits:
ArtfullyOseController show all
Defined in:
app/controllers/actions_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



22
23
24
25
# File 'app/controllers/actions_controller.rb', line 22

def create
  return apply_to_person if params[:person_id]
  return apply_to_search if params[:search_id] || params[:segment_id]
end

#editObject



16
17
18
19
20
# File 'app/controllers/actions_controller.rb', line 16

def edit
  @action = Action.find(params[:id])
  @person = Person.find(params[:person_id])
  render :layout => false
end

#newObject



8
9
10
11
12
13
14
# File 'app/controllers/actions_controller.rb', line 8

def new
  @action = Action.new
  @form_action = form_action
  @action.creator = nil
  @action.occurred_at = DateTime.now.in_time_zone(current_user.current_organization.time_zone)
  render :layout => false
end

#updateObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'app/controllers/actions_controller.rb', line 27

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_url(@person)
  else
    flash[:alert] = "There was a problem editing your action, please contact support if the problem persists."
    redirect_to :back
  end

end