Module: Administrate::BaseController

Defined in:
lib/administrate/base_controller.rb,
lib/administrate/base_controller/version.rb

Constant Summary collapse

VERSION =
'0.7.0'

Instance Method Summary collapse

Instance Method Details

#editObject



23
24
25
# File 'lib/administrate/base_controller.rb', line 23

def edit
  render locals: { page: edit_page(requested_resource) }
end

#indexObject



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/administrate/base_controller.rb', line 5

def index
  resources = index_resources
  resources = apply_collection_includes(resources)
  resources = order.apply(resources)
  resources = resources.page(params[:_page]).per(records_per_page)

  respond_to do |format|
    format.json { render_index_json(resources) }
    format.any { render_index_any(resources, format: format) }
  end
end

#newObject



17
18
19
20
21
# File 'lib/administrate/base_controller.rb', line 17

def new
  resource = new_resource
  authorize_resource(resource)
  render locals: { page: new_page(resource) }
end

#showObject



27
28
29
30
31
32
# File 'lib/administrate/base_controller.rb', line 27

def show
  respond_to do |format|
    format.json { render_show_json(requested_resource) }
    format.any { render_show_any(requested_resource, format: format) }
  end
end