Class: Sail::ProfilesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/sail/profiles_controller.rb

Overview

ProfilesController

This controller implements all profile related APIs.

Instance Method Summary collapse

Instance Method Details

#createObject



11
12
13
14
15
16
17
# File 'app/controllers/sail/profiles_controller.rb', line 11

def create
  respond_to do |format|
    format.js do
      @profile, @new_record = Sail::Profile.create_or_update_self(s_params[:name])
    end
  end
end

#destroyObject



26
27
28
29
30
31
32
# File 'app/controllers/sail/profiles_controller.rb', line 26

def destroy
  respond_to do |format|
    format.js do
      @profile = Sail::Profile.find_by(name: s_params[:name]).destroy
    end
  end
end

#switchObject



19
20
21
22
23
24
# File 'app/controllers/sail/profiles_controller.rb', line 19

def switch
  respond_to do |format|
    format.js { Sail::Profile.switch(s_params[:name]) }
    format.json { Sail::Profile.switch(s_params[:name]) }
  end
end