I have a case on url that generated by kaminari paginate
as the url depends on a condition. Here is my routes
concern :search do
scope '/search', as: :search do
get '/', to: 'users#search'
get '/schedule/:id', to: 'schedules#doctor', as: :schedule
end
end
concerns :search
scope :dashboard, as: :dashboard do
concerns :search
end
As you can see, the :search
is accessible through /search
and /dashboard/search
. The problem is, paginate @doctors
gives /search
which basically will goes to search_path
even though I'm on dashboard_search_path
(it should gives /dashboard/search
path).
My question is, how can I pass a custom path to paginate
? I'd like paginate
to use search_path
when I open /search
and use dashboard_search_path
when I'm on /dashboard/search/path
.
You don't have to provide how to decide /search
or /dashboard/search
, I just need to know how to pass it to paginate
as an argument. Ta
"/dashboard"
to the existing base URL. If you're looking to change the base URL itself, this may not work. – Handcraft