Ruby on Rails Wednesday, June 30, 2010

I am trying to port an existing rails app running rails 2.3.8 to
3.0.0beta4

I use this paginate_by_sql hack


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})
find_by_sql(sql)
end

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

The add_limit! method has been removed from ActiveRecord::Base class.
Are there any work arounds for this? Any alternatives to doing
pagination by SQL in Rails 3.0.0?

Thanks

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment