As I understand it, in order to use a partial like being suggested here, the file has to be in the look up path. This would mean that even under this approach templates would resolve in ways that I do not intend, since render uses the view path to find its template candidates. I have built something similar to this, but I have to handle a lot of what Rails handles out of the box. :(
On Thursday, August 31, 2017 at 10:10:14 AM UTC-4, Gabriel Sobrinho wrote: > > I'm thinking that you may use a app helper for that. > > Let's say that you are using erb, you may have something like that: > > app/views/ > shared/ > _foo.html.erb > _bar.html.erb > v1/ > some.html.erb > v2/ > some.html.erb > > You can implement a simple helper like that: > > <%= shared 'foo' %> > > And use something like that: > > def shared(template, *options) > # You may have business rules here to discover the path. > render "shared/#{template}", *options > end > > > You aren't probably using ERB but you have similar ways to accomplish the > same helper feature in almost all of them. > > That is not enough? > > > I'm not against symlink functionality (I'm not even in the core xD), I'm > just trying to understand your requirement here. > > On 31 Aug 2017, at 11:04, Andrew Kaspick <akas...@gmail.com <javascript:>> > wrote: > > Sounds like some pretty specific requirements for what you need which is a > good candidate for an external gem. > > On Thu, Aug 31, 2017 at 10:22 AM, Cory Gwin <gwin...@gmail.com > <javascript:>> wrote: > >> I also think partials will be problematic because we don't want the >> templates themselves to be in the look up path for Rails. >> >> >> On Wednesday, August 30, 2017 at 9:21:44 AM UTC-4, Cory Gwin wrote: >>> >>> Hello, >>> >>> I am exploring a possible feature for an app I am working on. Ideally we >>> would like to be able to symlink templates so we can use them in multiple >>> paths easily, partials are not really a good option for our use case. I >>> have written a custom template resolver built on top of >>> ActionView::PathResolver to accomplish this. I was speaking with >>> eileencodes about this feature and trying to explore the idea of Rails >>> having native support for this, she said I should start a discussion here. >>> >>> What do people think? I would love to have this natively supported and >>> would be more than happy to work on a PR. >>> >>> Thanks, >>> Cory >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ruby on Rails: Core" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to rubyonrails-core+unsubscr...@googlegroups.com <javascript:>. >> To post to this group, send email to rubyonra...@googlegroups.com >> <javascript:>. >> Visit this group at https://groups.google.com/group/rubyonrails-core. >> For more options, visit https://groups.google.com/d/optout. >> > > > -- > You received this message because you are subscribed to a topic in the > Google Groups "Ruby on Rails: Core" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/rubyonrails-core/5oNEFAMLvT8/unsubscribe > . > To unsubscribe from this group and all its topics, send an email to > rubyonrails-core+unsubscr...@googlegroups.com <javascript:>. > To post to this group, send email to rubyonra...@googlegroups.com > <javascript:>. > Visit this group at https://groups.google.com/group/rubyonrails-core. > For more options, visit https://groups.google.com/d/optout. > > > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at https://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/d/optout.