A
A
Anton Misyagin2016-12-01 00:30:25
Ruby on Rails
Anton Misyagin, 2016-12-01 00:30:25

How to set up the kaminari gem if multiple routes point to the same action?

There are multiple routes leading to the same action:
routes.rb

#Группы категории
  Category.group_routes.each do |group|
    get	group, :to=> 'search#_category_group'
  end

these lines give the following paths:
/Christmas/toys
/stuffed/toys
/mosaics
, etc.
the transition on each of them causes the same action
in the action, depending on the path, the corresponding selection is made from the database.
then all items are displayed in the view and at the end of the view I assign:
= paginate @items
So, regardless of whether we are in soft toys or rubik's cubes, pagination links lead to the first route. Those. being on the first page of mosaics and clicking "Next page" we find ourselves on the second page of New Year's toys. How to specify which route to use? I refuse to write a separate action for each category.
The same problem on another example is described by me here

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Misyagin, 2016-12-05
@sunnmas

The kaminari developer replied that there is no such possibility and each route should have its own action ((

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question