Ezequiel Schwartzman
2011-Aug-10 15:20 UTC
Where is the Rails-way to place view that is not related to any specific controller?
Well, I have a "sidebar" in a website that is rendered inside the main layout. What I want to do is to put the sidebar in a separated file and then call = render :partial => "sidebar.html.haml" Just to have them in separated files. Where is the convention to put it? In the root of /app/views? In /app/views/application? In /app/views/layout? In a separated view folder? -- Posted via http://www.ruby-forum.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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Frederick Cheung
2011-Aug-10 15:59 UTC
Re: Where is the Rails-way to place view that is not related to any specific controller?
On Aug 10, 4:20 pm, Ezequiel Schwartzman <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Well, I have a "sidebar" in a website that is rendered inside the main > layout. What I want to do is to put the sidebar in a separated file and > then call > > = render :partial => "sidebar.html.haml" > > Just to have them in separated files. > > Where is the convention to put it? > In the root of /app/views? > In /app/views/application? > In /app/views/layout? > In a separated view folder?I often have app/views/shared or things like that. Fred> > -- > Posted viahttp://www.ruby-forum.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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
Ezequiel Schwartzman
2011-Aug-10 16:09 UTC
Re: Where is the Rails-way to place view that is not related to any specific controller?
Frederick Cheung wrote in post #1015986:> On Aug 10, 4:20pm, Ezequiel Schwartzman <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> In /app/views/application? >> In /app/views/layout? >> In a separated view folder? > > I often have app/views/shared or things like that. > > FredThanks, I''ll do that ^^ -- Posted via http://www.ruby-forum.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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Rodrigo Alves Vieira
2011-Aug-10 17:17 UTC
Re: Where is the Rails-way to place view that is not related to any specific controller?
I''d rather put them in app/views/layouts since app/views/shared seems a bit vague for me. On Aug 10, 2011, at 1:09 PM, Ezequiel Schwartzman wrote:> Frederick Cheung wrote in post #1015986: >> On Aug 10, 4:20pm, Ezequiel Schwartzman <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >>> In /app/views/application? >>> In /app/views/layout? >>> In a separated view folder? >> >> I often have app/views/shared or things like that. >> >> Fred > > Thanks, I''ll do that ^^ > > -- > Posted via http://www.ruby-forum.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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
7stud --
2011-Aug-10 18:08 UTC
Re: Where is the Rails-way to place view that is not related to any specific controller?
"Ruby on Rails 3 Tutorial" puts them in the layouts directory, e.g. layouts/_sidebar.html.erb, which are then inserted with: <% render ''layouts/sidebar'' %> -- Posted via http://www.ruby-forum.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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Ezequiel Schwartzman
2011-Aug-10 20:29 UTC
Re: Where is the Rails-way to place view that is not related to any specific controller?
7stud -- wrote in post #1016015:> "Ruby on Rails 3 Tutorial" puts them in the layouts directory, e.g. > layouts/_sidebar.html.erb, which are then inserted into the application > layout with: > > <% render ''layouts/sidebar'' %>That seems rational, since the scaffolding creates a _form element, thanks ^^ -- Posted via http://www.ruby-forum.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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Ezequiel Schwartzman
2011-Aug-10 20:53 UTC
Re: Where is the Rails-way to place view that is not related to any specific controller?
However, when you try to include a partial render from a layout and it is missing you can see that the paths where it search for the view are views/application and views/<controller>. So I assume that: shared partial renders should go into views/applications controller specific partial renders should go into views/<controller> both should be named with a starting underscore and called without it however if you wish to render the partial view from another controller you have to select the path calling render <controller>/<partial_view> At least that''s how I''m going to do from now on ^^ -- Posted via http://www.ruby-forum.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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.