Class: CheesecakeController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/cheesecake_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



4
5
6
# File 'app/controllers/cheesecake_controller.rb', line 4

def index
  @actors = current_subject.contact_actors(:direction => :sent)
end

#updateObject



8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/controllers/cheesecake_controller.rb', line 8

def update
  changes = JSON.parse params[:contacts_save_changes] if params[:contacts_save_changes].is_a? String

  if (actors = changes["actors"]).present? and actors.is_a? Array
    actors.each do |actor|
      next if (contact = Contact.find_by_id(actor["extraInfo"].to_i)).nil?
      contact.relation_ids = actor["subsectors"]
    end
  end

  @actors = current_subject.contact_actors(:direction => :sent)
end