lib/dynamic_scaffold/controller.rb
def index # rubocop:disable Metrics/AbcSize
      @records = dynamic_scaffold.list.build_sql(scope_params)
      @count = @records.count unless dynamic_scaffold.max_count.nil?
      @records = handle_pagination(@records)
      @records = @records.order dynamic_scaffold.list.sorter if dynamic_scaffold.list.sorter
      @records = @records.order(*dynamic_scaffold.list.order) unless dynamic_scaffold.list.order.empty?

      ret = yield(@records) if block_given?
      @records = ret unless ret.nil?
      unless @records.is_a? ::ActiveRecord::Relation
        raise(
          Error::InvalidOperation,
          'You must return ActiveRecord::Relation from super block'
        )
      end

      @records
    end
def index # rubocop:disable Metrics/AbcSize
      @records = dynamic_scaffold.list.build_sql(scope_params)
      @count = @records.count unless dynamic_scaffold.max_count.nil?
      @records = handle_pagination(@records)
      @records = @records.order dynamic_scaffold.list.sorter if dynamic_scaffold.list.sorter
      @records = @records.order(*dynamic_scaffold.list.order) unless dynamic_scaffold.list.order.empty?

      ret = yield(@records) if block_given?
      @records = ret unless ret.nil?
      unless @records.is_a? ::ActiveRecord::Relation
        raise(
          Error::InvalidOperation,
          'You must return ActiveRecord::Relation from super block'
        )
      end

      @records
    end
Actions