I have a client Rails project, and I''d like to create a folder outside of the Rails app completely. The client could create vanilla HTML files and drop them into the folder. I''d then like to render those HTML files as partials against the main site template. I want to keep the client as far from the actual Rails app as possible. Is there a way for me to render partials from outside the Rails root? Or at least outside views? Thanks, Jeff --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
render :file => ... On Jan 2, 12:32 am, Jeff <jeffpatter...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I have a client Rails project, and I''d like to create a folder outside > of the Rails app completely. The client could create vanilla HTML > files and drop them into the folder. I''d then like to render those > HTML files as partials against the main site template. I want to keep > the client as far from the actual Rails app as possible. Is there a > way for me to render partials from outside the Rails root? Or at least > outside views? > > Thanks, > Jeff--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I''m using render :file, but as far as I can tell, Rails still tacks RAILS_ROOT/app/views to the beginning of the given filename. Is there a way to disable this? Ideally, I''d be rendering the partial from outside the Rails root entirely. On Jan 2, 3:42 am, Andrius Chamentauskas <sinsil...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> render :file => ... > > On Jan 2, 12:32 am, Jeff <jeffpatter...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I have a client Rails project, and I''d like to create a folder outside > > of the Rails app completely. The client could create vanilla HTML > > files and drop them into the folder. I''d then like to render those > > HTML files as partials against the main site template. I want to keep > > the client as far from the actual Rails app as possible. Is there a > > way for me to render partials from outside the Rails root? Or at least > > outside views? > > > Thanks, > > Jeff--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
From the API: File rendering works just like action rendering except that it takes a filesystem path. By default, the path is assumed to be absolute, and the current layout is not applied. # Renders the template located at the absolute filesystem path render :file => "/path/to/some/template.erb" render :file => "c:/path/to/some/template.erb" # Renders a template within the current layout, and with a 404 status code render :file => "/path/to/some/template.erb", :layout => true, :status => 404 render :file => "c:/path/to/some/template.erb", :layout => true, :status => 404 Based on that you should be able to use one of the 2 first samples and modify it for your needs. Pepe On Jan 2, 1:39 pm, Jeff <jeffpatter...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''m using render :file, but as far as I can tell, Rails still tacks > RAILS_ROOT/app/views to the beginning of the given filename. Is there > a way to disable this? Ideally, I''d be rendering the partial from > outside the Rails root entirely. > > On Jan 2, 3:42 am, Andrius Chamentauskas <sinsil...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > render :file => ... > > > On Jan 2, 12:32 am, Jeff <jeffpatter...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > I have a client Rails project, and I''d like to create a folder outside > > > of the Rails app completely. The client could create vanilla HTML > > > files and drop them into the folder. I''d then like to render those > > > HTML files as partials against the main site template. I want to keep > > > the client as far from the actual Rails app as possible. Is there a > > > way for me to render partials from outside the Rails root? Or at least > > > outside views? > > > > Thanks, > > > Jeff--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks for the help on this. I figured out what my problem was. render :partial works as advertised when used in a controller, but not as a helper when used in a view (at least in Rails 2.0.2). The helper version of render tries to tack the view path to the beginning of the filepath no matter what. Instead, I used render_to_string form the controller and used the string directly in the view. This may have been fixed in a subsequent version of Rails. On Jan 3, 9:58 am, pepe <P...-1PhG29ZdMB/g+20BJ0uB2w@public.gmane.org> wrote:> From the API: > > File rendering works just like action rendering except that it takes a > filesystem path. By default, the path is assumed to be absolute, and > the current layout is not applied. > > # Renders the template located at the absolute filesystem path > render :file => "/path/to/some/template.erb" > render :file => "c:/path/to/some/template.erb" > > # Renders a template within the current layout, and with a 404 > status code > render :file => "/path/to/some/template.erb", :layout => > true, :status => 404 > render :file => "c:/path/to/some/template.erb", :layout => > true, :status => 404 > > Based on that you should be able to use one of the 2 first samples and > modify it for your needs. > > Pepe > > On Jan 2, 1:39 pm, Jeff <jeffpatter...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I''m using render :file, but as far as I can tell,Railsstill tacks > > RAILS_ROOT/app/views to the beginning of the given filename. Is there > > a way to disable this? Ideally, I''d be rendering thepartialfrom > >outsidetheRailsroot entirely. > > > On Jan 2, 3:42 am, Andrius Chamentauskas <sinsil...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > render :file => ... > > > > On Jan 2, 12:32 am, Jeff <jeffpatter...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > I have a clientRailsproject, and I''d like to create a folderoutside > > > > of theRailsapp completely. The client could create vanilla HTML > > > > files and drop them into the folder. I''d then like to render those > > > > HTML files as partials against the main site template. I want to keep > > > > the client as far from the actualRailsapp as possible. Is there a > > > > way for me to render partials fromoutsidetheRailsroot? Or at least > > > >outsideviews? > > > > > Thanks, > > > > Jeff--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---