Project

General

Profile

Depreacated Pagination error

Added by Jack BJ about 7 years ago

Hi All,
I am developing a redmine time sheet application according to the company requirements.
I am using
Rails version : 4.2.7.1
Ruby :2.3
Redmine : 3.3.2

I have this code in the my controller which is used to show the entires of the timesheet according to the user.

def fetch_page_entries
    filter_conditions

    @timesheet_entries_pages, @timesheet_entries = paginate TimesheetEntry,
      :per_page => 25,
      :conditions => [@conditions.keys.join(" AND "), *@conditions.values],
      :order => @order
  end

The warning shown on the server is
""DEPRECATION WARNING: #paginate with a Symbol and/or find options is depreceted and will be removed. Use a scope instead. (called from deprecated_paginate at /ruby-test/redmine/lib/redmine/pagination.rb:137) "

The error shown in the view is

"undefined method `scoped' for #<Class:0x000000052fd618> Did you mean? scope unscoped
ActiveSupport::Deprecation.warn "#paginate with a Symbol and/or find options is depreceted and will be removed. Use a scope instead." 
      klass = arg.is_a?(Symbol) ? arg.to_s.classify.constantize : arg
      scope = klass.scoped(finder_options)
      paginate(scope, options)
    end" 

Could someone please help me with this pagination error?