Open rwd opened 9 years ago
I think we got around that for some other helpers by whitelisting the relevant application helpers:
def main_app_url_helper?(method)
(method.to_s.end_with?('_path') || method.to_s.end_with?('_url')) &&
main_app.respond_to?(method)
end
I wonder if we should add that to the particular route to the whitelist, and hope there aren't too many similar ones (or, build out some engine configuration so application's can push the relevant overrides to Spotlight)?
Another couple workarounds I can think of are::
url_for_document
into a Blacklight::DocumentPresenter
config/routes.rb
file to do the appropriate routing.blacklight_config.show.route
[1] instead of overriding the helper#to_model
or other appropriate Rails model routing methods@jcoyne @jkeck @mejackreed ?
I don't think that the whitelist in Spotlight::ApplicationHelper#main_app_url_helper?
will help here because the method is not missing; it is provided by Blacklight and so #main_app_url_helper?
never gets called for it.
Blacklight's strategy for allowing helpers to be overriden by an app, by using behavior modules, does not work with Spotlight.
For example, given a helper in the app containing:
Blacklight will use the app's overriden helper method, but Spotlight will not.
I expect that this is due to the Rails engine having isolated namespace and so being unaware of overrides in the app.