Class: ClientManager::ClientsController
Instance Method Summary
collapse
#authenticate_superadmin, #authenticate_user, #client_manager_current_user
Instance Method Details
#create ⇒ Object
19
20
21
22
23
24
25
26
27
|
# File 'app/controllers/client_manager/clients_controller.rb', line 19
def create
@client = client_manager_current_user.clients.new(client_params)
if @client.save
flash[:success] = "Client successfully created"
else
flash[:error] = @client.errors.empty? ? "Error" : @client.errors.full_messages.uniq.to_sentence
end
redirect_to clients_path
end
|
#destroy ⇒ Object
29
30
31
32
|
# File 'app/controllers/client_manager/clients_controller.rb', line 29
def destroy
@client.destroy
redirect_to clients_path
end
|
#index ⇒ Object
7
8
9
|
# File 'app/controllers/client_manager/clients_controller.rb', line 7
def index
@clients = ClientManager::Client.where(user_id: client_manager_current_user.id)
end
|
#new ⇒ Object
11
12
13
|
# File 'app/controllers/client_manager/clients_controller.rb', line 11
def new
@client = client_manager_current_user.clients.new
end
|
#show ⇒ Object
15
16
17
|
# File 'app/controllers/client_manager/clients_controller.rb', line 15
def show
end
|