-
Notifications
You must be signed in to change notification settings - Fork 864
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
no matching route error even though route exists #463
Comments
I think this issue is related to #172 The problem is related to the url scope when you create an engine you have 2 url sets, for example will_paginate by default user application scope to create the paginate urls. I found 2 possible solutions. Use subclass WillPaginate::ActionView::LinkRenderer, override the method url and using an extra option to pass your engine url scope, for example: class CustomLinkRenderer < WillPaginate::ActionView::LinkRenderer
def url(page)
@base_url_params ||= begin
url_params = merge_get_params(default_url_params)
url_params[:only_path] = true
merge_optional_params(url_params)
end
url_params = @base_url_params.dup
add_current_page_param(url_params, page)
if @options[:url_scope]
@options[:url_scope].url_for(url_params)
else
@template.url_for(url_params)
end
end
end And then in the view: <%= will_paginate table.collection, renderer: CustomLinkRenderer, url_scope: FullcalendarEngine::Engine.routes %> Or the other option is passed all engine routes to the application url scope, like this: # app/controllers/application_controller.rb
module Emerald
class ApplicationController < ActionController::Base
helper FullcalendarEngine::Engine.routes.url_helpers
include FullcalendarEngine::Engine.routes.url_helpers
# ..
end
end |
Unfortunately, neither of these solutions worked for me. |
|
This works fine:
because I specified the route in routes.rb:
Yet when I try to generate a path to /fullcalendar_engine using will_paginate:
I get the following error:
No route matches {:action=>"index", :controller=>"fullcalendar_engine", :id=>"56721d6f6d61632e8c020000", :page=>2}
Why would it give this error when the route exists?
The text was updated successfully, but these errors were encountered: