Class: Admin::Select2AjaxController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Admin::Select2AjaxController
show all
- Includes:
- Effective::Select2AjaxController
- Defined in:
- app/controllers/admin/select2_ajax_controller.rb
Instance Method Summary
collapse
#respond_with_select2_ajax
Instance Method Details
#users ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'app/controllers/admin/select2_ajax_controller.rb', line 8
def users
collection = current_user.class.all
if collection.respond_to?(:to_select2)
collection = collection.to_select2
elsif collection.respond_to?(:sorted)
collection = collection.sorted
end
respond_with_select2_ajax(collection) do |user|
{ id: user.to_param, text: user.try(:to_select2) || to_select2(user) }
end
end
|