Class: Shipit::ApiClientsController
- Inherits:
-
ShipitController
- Object
- ApplicationController
- ShipitController
- Shipit::ApiClientsController
- Includes:
- Pagination
- Defined in:
- app/controllers/shipit/api_clients_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
17 18 19 20 21 22 |
# File 'app/controllers/shipit/api_clients_controller.rb', line 17 def create @api_client = ApiClient.new(create_params.merge(creator_id: current_user.id)) flash[:warning] = @api_client.errors..to_sentence unless @api_client.save respond_with(@api_client) end |
#index ⇒ Object
7 8 9 10 11 |
# File 'app/controllers/shipit/api_clients_controller.rb', line 7 def index paginator = paginate(ApiClient.order(created_at: :desc).all) @api_clients = paginator.to_a @links = paginator.links end |
#new ⇒ Object
13 14 15 |
# File 'app/controllers/shipit/api_clients_controller.rb', line 13 def new @api_client = ApiClient.new end |
#show ⇒ Object
24 25 26 |
# File 'app/controllers/shipit/api_clients_controller.rb', line 24 def show @api_client = ApiClient.find(params[:id]) end |
#update ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'app/controllers/shipit/api_clients_controller.rb', line 28 def update @api_client = ApiClient.find(params[:id]) = if @api_client.update(update_params) { flash: { success: 'Successfully updated' } } else { flash: { warning: @stack.errors..to_sentence } } end redirect_to(params[:return_to].presence || api_client_path(@api_client), ) end |