Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined method `each' for 1:Fixnum #13

Open
Meekohi opened this issue Apr 5, 2017 · 4 comments
Open

undefined method `each' for 1:Fixnum #13

Meekohi opened this issue Apr 5, 2017 · 4 comments

Comments

@Meekohi
Copy link

Meekohi commented Apr 5, 2017

def index
  paginate Loan.unscoped
end
Started GET "/loans" for 127.0.0.1 at 2017-04-05 11:31:31 -0400
Processing by LoansController#index as */*
  Parameters: {"loan"=>{}}
  CACHE (0.0ms)  SELECT COUNT(*) FROM "loans"
  CACHE (0.0ms)  SELECT  "loans".* FROM "loans" LIMIT $1 OFFSET $2  [["LIMIT", 25], ["OFFSET", 0]]
Completed 200 OK in 129ms (Views: 127.6ms | ActiveRecord: 0.0ms)


Unexpected error while processing request: undefined method `each' for 1:Fixnum
  /thin-1.7.0/lib/thin/response.rb:74:in `block in headers='
  /rack-2.0.1/lib/rack/utils.rb:454:in `block in each'
  /rack-2.0.1/lib/rack/utils.rb:453:in `each'
  /rack-2.0.1/lib/rack/utils.rb:453:in `each'
  /thin-1.7.0/lib/thin/response.rb:69:in `headers='
  /thin-1.7.0/lib/thin/connection.rb:102:in `post_process'
  /thin-1.7.0/lib/thin/connection.rb:53:in `process'
  /thin-1.7.0/lib/thin/connection.rb:39:in `receive_data'
  /eventmachine-1.2.2/lib/eventmachine.rb:194:in `run_machine'
  /eventmachine-1.2.2/lib/eventmachine.rb:194:in `run'
  /thin-1.7.0/lib/thin/backends/base.rb:73:in `start'
  /thin-1.7.0/lib/thin/server.rb:162:in `start'
  /rack-2.0.1/lib/rack/handler/thin.rb:22:in `run'
  /rack-2.0.1/lib/rack/server.rb:296:in `start'
  /railties-5.0.0.1/lib/rails/commands/server.rb:79:in `start'
  /railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:90:in `block in server'
  /railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:85:in `tap'
  /railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:85:in `server'
  /railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
  /railties-5.0.0.1/lib/rails/commands.rb:18:in `<top (required)>'
  /bin/rails:9:in `require'
  /bin/rails:9:in `<top (required)>'
  /spring-2.0.0/lib/spring/client/rails.rb:28:in `load'
  /spring-2.0.0/lib/spring/client/rails.rb:28:in `call'
  /spring-2.0.0/lib/spring/client/command.rb:7:in `call'
  /spring-2.0.0/lib/spring/client.rb:30:in `run'
  /spring-2.0.0/bin/spring:49:in `<top (required)>'
  /spring-2.0.0/lib/spring/binstub.rb:31:in `load'
  /spring-2.0.0/lib/spring/binstub.rb:31:in `<top (required)>'
  /bin/spring:14:in `require'
  /bin/spring:14:in `<top (required)>'
  bin/rails:3:in `load'
  bin/rails:3:in `<main>'
@frostmark
Copy link

frostmark commented Apr 7, 2017

@Meekohi, I think here he problem is not in this gem.
pls show me what return Loan.unscoped

@Meekohi
Copy link
Author

Meekohi commented Apr 7, 2017

Loan is just a pretty standard ActiveRecord model. This is ruby 2.4.1, rails 4.2.8, not sure if that would matter.

paginate Loan.unscoped, per_page: 5

gives undefined methodeach' for 5:Fixnum` so seems related to the per_page parameter.

@kurenn
Copy link
Member

kurenn commented Apr 7, 2017

Have you tried with another scope? just to see if it is the actual collection...

@kurenn
Copy link
Member

kurenn commented Jun 5, 2018

Which handler of pagination are you using?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants