Forum: Ruby on Rails where to put pagination_by_sql code?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Rm R. (Guest)
on 2007-06-01 05:50
I am trying to use the pagination_by_sql explained here :

Now I don't know where to put the following code sso that all the models
could use it.

module ActiveRecord
    class Base
        def self.find_by_sql_with_limit(sql, offset, limit)
            sql = sanitize_sql(sql)
            add_limit!(sql, {:limit => limit, :offset => offset})

        def self.count_by_sql_wrapping_select_query(sql)
            sql = sanitize_sql(sql)
            count_by_sql("select count(*) from (#{sql}) as my_table")

But I can't figure out where the code for ActiveRecord would go? Where
is the activerrecord base class in the directory structure to modify?

This topic is locked and can not be replied to.