panoramic
panoramic copied to clipboard
Adding criteria to find_model_templates
Is there a workflow to add criteria to the finder for templates, for example having different templates per user?
For that, I suppose we would have to somehow pass the @current_user to the finder in the controller, and for that to hook into panoramic.
Hi there,
once you have a setup for the model to store store views, you might want to use the path field and, for example, store the user id of a specific view. Then you might use prepend_view_path TemplateStorage.resolver(:only => current_user.id) to search in virtual paths which have the user id prefix.
If you check the source code of this gem and/or check how rails templating works, you might find better solutions. Unfortunately, I'm not using rails since years, I'm just maintaining this gem to keep it working with newer versions of rails.
OK, thanks for your comments. There is also the "additional_criteria" that can be added per render, although that seems like I'd have to add it to every render call on the site, which is a bit clunky. Your idea seems better.