Generalized datatable class

This commit is contained in:
Nishanth Vijayan 2016-08-09 21:01:14 +05:30
parent caa63f9c1c
commit 6cb6ddf78d
4 changed files with 63 additions and 54 deletions

View file

@ -7,9 +7,10 @@ module Admin
end
def index
users_datatable = Datatable.new(view_context, User.where(nil), %w(name email), %w(id state email name))
respond_to do |format|
format.html
format.json { render json: UsersDatatable.new(view_context) }
format.json { render json: users_datatable.to_json(data: users_datatable.paginated_records.map {|user| users_datatable_data(user)}) }
end
end