Paginate on model/controller within modules

I am trying to use pagination helper inside a controller which is part
of a “module”, and also the model is within a “module” as well.

=== controller code fragment ===

@user_things_pages, @user_things = paginate :progresses,
:conditions => conditions,

=== Here are my active record models, grouped into modules ===

class Goals::UserController < Goals::BaseController
class Goals::Progress < ActiveRecord::Base

When trying to load the page, I get the following error below.
(But doing something like Progress.find(:all) seems to work just fine)

Is there something I am missing?


uninitialized constant Progress

RAILS_ROOT: ./script/…/config/…
Application Trace | Framework Trace | Full Trace

c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:100:in
const_missing' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:131:inconst_missing’
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/inflector.rb:161:in
constantize' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/core_ext/string/inflections.rb:59:inconstantize’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/pagination.rb:194:in
paginator_and_collection_for' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/pagination.rb:129:inpaginate’
#{RAILS_ROOT}/app/controllers/goals/user_controller.rb:31:in `view’

You could easily work around this issue by using classic pagination,
have a look at:

http://api.rubyonrails.com/classes/ActionController/Pagination.html

Tobias Schlottke wrote:

You could easily work around this issue by using classic pagination,
have a look at:

http://api.rubyonrails.com/classes/ActionController/Pagination.html

Thanks, that was helpful as a workaround.

I played around a bit and found that by suing ‘goals/progresses’, it was
able to find the Progress constant.

@user_things_pages, @user_things = paginate ‘goals/progresses’,
:conditions => conditions,

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs