Class: AtomicAdmin::AtomicTenantPlatformGuidStrategyController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- AtomicAdmin::AtomicTenantPlatformGuidStrategyController
- Defined in:
- app/controllers/atomic_admin/atomic_tenant_platform_guid_strategy_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #find_pinned_platform_guid ⇒ Object
- #pinned_platform_guid_params ⇒ Object
- #search ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
def index
page = AtomicTenant::PinnedPlatformGuid.all.order(:id).paginate(page: params[:page], per_page: 30)
render json: {
pinned_platform_guids: page,
page: params[:page],
total_pages: page.total_pages
}
end
35 36 37 38 |
# File 'app/controllers/atomic_admin/atomic_tenant_platform_guid_strategy_controller.rb', line 35 def create result = AtomicTenant::PinnedPlatformGuid.create!(pinned_platform_guid_params) render json: { pinned_platform_guid: result } end |
#destroy ⇒ Object
52 53 54 55 56 |
# File 'app/controllers/atomic_admin/atomic_tenant_platform_guid_strategy_controller.rb', line 52 def destroy pinned_platform_guid = find_pinned_platform_guid pinned_platform_guid.destroy render json: { pinned_platform_guid: pinned_platform_guid } end |
#find_pinned_platform_guid ⇒ Object
11 12 13 |
# File 'app/controllers/atomic_admin/atomic_tenant_platform_guid_strategy_controller.rb', line 11 def find_pinned_platform_guid AtomicTenant::PinnedPlatformGuid.find(params[:id]) end |
#pinned_platform_guid_params ⇒ Object
7 8 9 |
# File 'app/controllers/atomic_admin/atomic_tenant_platform_guid_strategy_controller.rb', line 7 def pinned_platform_guid_params params.permit(:iss, :platform_guid, :application_id, :application_instance_id) end |
#search ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/atomic_admin/atomic_tenant_platform_guid_strategy_controller.rb', line 15 def search page = AtomicTenant::PinnedPlatformGuid .where(application_instance_id: params[:application_instance_id]) .order(:id).paginate(page: params[:page], per_page: 30) render json: { pinned_platform_guids: page, page: params[:page], total_pages: page.total_pages } end |
#show ⇒ Object
40 41 42 43 |
# File 'app/controllers/atomic_admin/atomic_tenant_platform_guid_strategy_controller.rb', line 40 def show pinned_platform_guid = find_pinned_platform_guid render json: {pinned_platform_guid: pinned_platform_guid} end |
#update ⇒ Object
45 46 47 48 49 50 |
# File 'app/controllers/atomic_admin/atomic_tenant_platform_guid_strategy_controller.rb', line 45 def update pinned_platform_guid = find_pinned_platform_guid pinned_platform_guid.update!(pinned_platform_guid_params) render json: {pinned_platform_guid: find_pinned_platform_guid} end |