Class: Voluntary::Api::V1::OrganizationsController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- Voluntary::Api::V1::OrganizationsController
- Includes:
- V1::BaseController
- Defined in:
- app/controllers/voluntary/api/v1/organizations_controller.rb
Instance Method Summary collapse
Methods included from V1::BaseController
#parent, #voluntary_application_javascripts, #voluntary_application_stylesheets
Instance Method Details
#index ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/controllers/voluntary/api/v1/organizations_controller.rb', line 9 def index = {} collection = Organization.order('name') collection = collection.where(user_id: params[:user_id]) if params[:user_id].present? [:json] = collection.paginate(page: params[:page], per_page: 100) [:meta] = { pagination: { total_pages: [:json].total_pages, current_page: [:json].current_page, previous_page: [:json].previous_page, next_page: [:json].next_page } } respond_with do |format| format.json { render } end end |