Skip to content

NoMethodError when page is not a hash #347

Closed

Description

@fmluizao

Request:

/some_controller?limit=10&page=1

Error:

undefined method `each_pair' for "1":String
Did you mean?  each_char

The error comes from here:

# graphiti/query.rb
 def pagination
      @pagination ||= begin
        {}.tap do |hash|
          (@params[:page] || {}).each_pair do |name, value|

Would you accept a pull request to handle that gracefully?

Activity

  1. richmolj commented on Mar 24, 2021

    @richmolj
    Contributor

    To throw a better error? Absolutely!

  2. fmluizao commented on Mar 24, 2021

    @fmluizao
    Author

    Which kind of error should we throw? Some kind of schema error?

  3. richmolj commented on Mar 24, 2021

    @richmolj
    Contributor

    I think a Graphiti::Errors::InvalidRequest. In fact this is what we throw for writes, and have validator classes for writes https://github.com/graphiti-api/graphiti/tree/master/lib/graphiti/request_validators

    Ideally we'd do the something similar for reads (already runs through a validator and does nothing actually - https://github.com/graphiti-api/graphiti/blob/master/lib/graphiti/request_validators/validator.rb#L17)

  4. added
    bug
    good first issue
    on Jul 29, 2026
  5. added a commit that references this issue on Aug 9, 2026
    bb3698b
  6. added a commit that references this issue on Aug 9, 2026
  7. github-actions commented on Aug 9, 2026

    @github-actions
    Contributor

    🎉 This issue has been resolved in version 1.13.3 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

  8. added a commit that references this issue on Aug 9, 2026
  9. github-actions commented on Aug 9, 2026

    @github-actions
    Contributor

    🎉 This issue has been resolved in version 2.0.0-beta.6 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

  10. github-actions commented on Aug 10, 2026

    @github-actions
    Contributor

    🎉 This issue has been resolved in version 2.0.0-beta.8 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

  11. added a commit that references this issue on Sep 1, 2026
  12. github-actions commented on Sep 1, 2026

    @github-actions
    Contributor

    🎉 This issue has been resolved in version 2.0.0 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

  13. github-actions commented on Sep 4, 2026

    @github-actions
    Contributor

    🎉 This issue has been resolved in version 1.13.3 🎉

    The release is available on GitHub release

    Your semantic-release bot 📦🚀

  14. added a commit that references this issue on Sep 8, 2026
    fbb5683
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buggood first issuereleasedreleased on @1.xreleased on @beta

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions