[Rails-core] Re: Symlinked templates

2017-08-31 Thread Gabriel Sobrinho
Why aren't partials a good option? On Wednesday, August 30, 2017 at 10:21:44 AM UTC-3, 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

[Rails-core] Re: Symlinked templates

2017-08-31 Thread Cory Gwin
We are using Rails to serve static templates from a Git repo. We have template writers who are writing Ditta style templates that are single sourced. What this means is that they write a template that may be used in various versions of documentation which will live at different urls, ie /v2/tem

[Rails-core] Re: Symlinked templates

2017-08-31 Thread Cory Gwin
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 t

Re: [Rails-core] Re: Symlinked templates

2017-08-31 Thread Andrew Kaspick
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 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. > >

Re: [Rails-core] Re: Symlinked templates

2017-08-31 Thread Gabriel Sobrinho
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

Re: [Rails-core] Re: Symlinked templates

2017-08-31 Thread Cory Gwin
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 so

Re: [Rails-core] Re: Symlinked templates

2017-08-31 Thread Cory Gwin
Yeah it is rather specific, although it is fairly trivial to implement. There is a file bin read in the template renderer, basically all that needs to happen is that you check if it is a symlink before that and resolve the symlink before reading the file. My reason for bringing it to the core g