is it possible to include a partial from within the global application.html.erb? I have a google ad in my application.html.erb I would like to move it to a partial _google.html.erb in my layouts directory to keep things CLEAN.. but i guess ERB is only looking in the current views directory not the layouts dir.. would not make sense to move it to a partial and then duplicate the _google.html.erb in all views, thats not very DRY.. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
You can do something like this: render :partial => ''your_directory/view_name'' So if you wanted to put _google.html.erb in the app/views/shared directory, you would do: render :partial => ''shared/google'' --Jeremy On Jan 6, 2008 5:37 PM, spokra <spokra-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > is it possible to include a partial from within the global > application.html.erb? > > I have a google ad in my application.html.erb I would like to move > it to a partial _google.html.erb in my layouts directory to keep > things CLEAN.. but i guess ERB is only looking in the current views > directory not the layouts dir.. would not make sense to move it to a > partial and then duplicate the _google.html.erb in all views, thats > not very DRY.. > > > > > > >-- http://www.jeremymcanally.com/ My books: Ruby in Practice http://www.manning.com/mcanally/ My free Ruby e-book http://www.humblelittlerubybook.com/ My blogs: http://www.mrneighborly.com/ http://www.rubyinpractice.com/ --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Sun, Jan 06, 2008 at 02:37:27PM -0800, spokra wrote:> is it possible to include a partial from within the global > application.html.erb? > > I have a google ad in my application.html.erb I would like to move > it to a partial _google.html.erb in my layouts directory to keep > things CLEAN.. but i guess ERB is only looking in the current views > directory not the layouts dir.. would not make sense to move it to a > partial and then duplicate the _google.html.erb in all views, thats > not very DRY..I often create a shared directory in app/views for such things. In your case, you''d have app/shared/_google.html.erb and refer to it as: <%= render :partial => ''/shared/google'' %> --Greg --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---