Quantcast
Channel: Active questions tagged ruby - Stack Overflow
Viewing all articles
Browse latest Browse all 4633

Pagination on Home Page - Want http://website.com/submissions/?page=2, not http://website.com/?page=2

$
0
0

I'm using the Pagy Gem for pagination. What i'm trying to do is render the partial in my Home page with the pagination (this is working how I want currently), but I want the 2 in 1,2,3 Next > to go to http://website.com/submissions/?page=2 not http://website.com/?page=2. I want this to go straight into Page 2 of my Submissions index, not Page 2 of the Home page.

Is there a way to add options for this? I tried looking into this and moving things around but cannot seem to get it. Any help would be appreciated!

Current Setup:

I'm rendering a partial into my index.html.erb in my Home folder.

<%= render "submissions/submissions", submission: @submission %>

This partial contains the code (the submissions items) I want to display plus the fast helper their documentation provides to output the pagination numbers below those submissions items:

<%== pagy_nav(@pagy) %>

application_controller.rb

include Pagy::Backend

application_helper.rb

include Pagy::Frontend

Wrapping collections with pagy in my index actions on submissions_controller.rb

def index  @pagy @submissions = pagy(Submission.all)end

Routes.rb:

root to: "home#index"

Viewing all articles
Browse latest Browse all 4633

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>