app/controllers/alchemy/custom/model/admin/base_controller.rb in alchemy-custom-model-2.1.2 vs app/controllers/alchemy/custom/model/admin/base_controller.rb in alchemy-custom-model-2.2.0
- old
+ new
@@ -18,10 +18,11 @@
def index
@query = base_class.ransack(params[:q])
@objects = @query.result(distinct: true)
@objects = @objects.accessible_by(current_ability).only_current_language
+ @total_objects = @objects
@objects = @objects.page(params[:page]).
per(params[:per_page] ||
(base_class::DEFAULT_PER_PAGE if base_class.const_defined? :DEFAULT_PER_PAGE) ||
25)
instance_variable_set "@#{base_class.name.demodulize.underscore.downcase.pluralize}", @objects
@@ -62,10 +63,11 @@
def show
if @obj.respond_to? self.class.method_for_show
@objects = @obj.send(self.class.method_for_show.to_sym)
@objects = @objects.accessible_by(current_ability)
+ @total_objects = @objects
@objects = @objects.page(params[:page]).
per(params[:per_page] ||
(base_class::DEFAULT_PER_PAGE if base_class.const_defined? :DEFAULT_PER_PAGE) ||
25)
instance_variable_set "@#{self.class.method_for_show.to_s.underscore.downcase.pluralize}", @objects
@@ -77,9 +79,10 @@
def export_csv
@query = base_class.ransack(params[:q])
@objects = @query.result(distinct: true)
@objects = @objects.accessible_by(current_ability)
+ @total_objects = @objects
@objects = @objects.page(params[:page]).
per(params[:per_page] ||
(base_class::DEFAULT_PER_PAGE if base_class.const_defined? :DEFAULT_PER_PAGE) ||
25)