administrate: Pagination broken on `show` pages

Reproduction

Given resource classes R and A such that “R has_many A”. Given r, an instance of R, with many associated instances of A, enough to trigger pagination.

  1. Visit the show page for r.
  2. Press “Next >” to see the next page of instances of A.

An exception ActionController::UnpermittedParameters will be raised, complaining of an unpermitted parameter as.

The problem

When the ability to paginate within show pages was introduced (#736), a bug slipped in. Pagination would only work if the associated resource class A had the name Order. The value :orders was hard-coded as a valid param name, making the relevant spec pass but any other usage broken.

Also see this conversation: https://github.com/thoughtbot/administrate/pull/736#pullrequestreview-65906248

Possible fix

Merging https://github.com/thoughtbot/administrate/pull/945 would fix this, so I suggest that we just wait until then.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 1
  • Comments: 17

Most upvoted comments

@jamiefolsom Could you please test now? #945 has just been merged, which I think should provide a fix.