[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

paginate?

fire3000

6/14/2006 8:47:00 AM

hello,
I have an paginate problem in the controller.
Note: I user the "Mytest::Account".
I can live with this, but any help is greatly appreciated.

code:
class Mytest::Account < ActiveRecord::Base
end

class Mytest::AccountController < ApplicationController
def index
list
render :action => 'list'
end
def list
@account_pages, @accounts = paginate :accounts, :per_page => 10
end

end



error:
NameError in Mytest/accountController#list
uninitialized constant Account
RAILS_ROOT: ./script/../config/..

Application Trace | Framework Trace | Full Trace
D:/tools/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:100:in
`const_missing'
D:/tools/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:131:in
`const_missing'
D:/tools/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/inflector.rb:161:in
`constantize'
D:/tools/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/core_ext/string/inflections.rb:59:in
`constantize'
D:/tools/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/pagination.rb:194:in
`paginator_and_collection_for'
D:/tools/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/pagination.rb:129:in
`paginate'
#{RAILS_ROOT}/app/controllers/mytest/account_controller.rb:13:in `list'
-e:4

3 Answers

zycte

6/14/2006 10:57:00 AM

0

module Mytest
class Account < ActiveRecord::Base
end

class AccountController < ApplicationController
def index
...
end
def list
@account_pages, @accounts = paginate :accounts, :per_page => 10
end
end

end

On 2006-06-14 10:46:48 +0200, fire3000@hzcnc.com said:

> hello,
> I have an paginate problem in the controller.
> Note: I user the "Mytest::Account".
> I can live with this, but any help is greatly appreciated.
>
> code:
> class Mytest::Account < ActiveRecord::Base
> end
>
> class Mytest::AccountController < ApplicationController
> def index
> list
> render :action => 'list'
> end
> def list
> @account_pages, @accounts = paginate :accounts, :per_page => 10
> end
>
> end
>
>
>
> error:
> NameError in Mytest/accountController#list
> uninitialized constant Account
> RAILS_ROOT: ./script/../config/..
>
> Application Trace | Framework Trace | Full Trace
> D:/tools/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:100:in
`const_missing'
D:/tools/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:131:in
`const_missing'
D:/tools/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/inflector.rb:161:in
`constantize'
D:/tools/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/core_ext/string/inflections.rb:59:in
`constantize'
D:/tools/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/pagination.rb:194:in
`paginator_and_collection_for'
D:/tools/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/pagination.rb:129:in
`paginate'
#{RAILS_ROOT}/app/controllers/mytest/account_controller.rb:13:in
>
> `list'
> -e:4


fire3000

6/15/2006 10:25:00 PM

0


who can helpe me!!!

Someone have same the problem!!!

fire3000

6/16/2006 3:21:00 AM

0

Thank everybody.
My problem has been resolved.
> @account_pages, @accounts = paginate :accounts, :per_page => 10
@account_pages, @accounts = paginate 'mytest/accounts', :per_page
=> 10