I''m looking at someone else''s code and I''m not sure what this does. In a controller action for ''show'' is the following: render :layout => ''edit'' Ok, there a layout for edit, basically it is the standard javascript includes, anti csfr stuff and ''yield''. Hmm, what''s it yielding to? Which template is it yielding to? There are both ''edit.html.erb'' and ''show.html.erb'' templates. Thanks, Joe -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/544cfda1-92bf-4625-8c7a-4968a319bd32%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
On Wed, Sep 11, 2013 at 7:00 PM, jmcguckin <mcguckin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> In a controller action for ''show'' is the following: > > render :layout => ''edit'' > > Ok, there a layout for edit, basically it is the standard javascript > includes, anti csfr stuff and ''yield''. > > Hmm, what''s it yielding to? Which template is it yielding to? There are both > ''edit.html.erb'' and ''show.html.erb'' templates.It would be yielding to whatever template the controller action would be using. In this case, that would be show.html.erb, since you''re in the show action. -Dave -- Dave Aronson, the T. Rex of Codosaurus LLC, secret-cleared freelance software developer taking contracts in or near NoVa or remote. See information at http://www.Codosaur.us/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAHxKQihjYOw-JFzo89ig-DB8hB1J1fp9MTUFt25miGjeXYZ12Q%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
On Wed, Sep 11, 2013 at 6:00 PM, jmcguckin <mcguckin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> In a controller action for ''show'' is the following: > > render :layout => ''edit'' > > Ok, there a layout for edit, basically it is the standard javascript > includes, anti csfr stuff and ''yield''. > > Hmm, what''s it yielding to? Which template is it yielding to? There are both > ''edit.html.erb'' and ''show.html.erb'' templates.Controller => show.html.erb => edit.html.erb That''s exactly it: edit.html.erb yields show.html.erb. Both the layout and the view are templates but the view goes into the layout. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAM5XQnx65sac3tW5B3nYKx2FWCkoeguRD97M3y08EwUTWtePrQ%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
On 2013-Sep-11, at 19:06 , Dave Aronson wrote:> On Wed, Sep 11, 2013 at 7:00 PM, jmcguckin <mcguckin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> In a controller action for ''show'' is the following: >> >> render :layout => ''edit'' >> >> Ok, there a layout for edit, basically it is the standard javascript >> includes, anti csfr stuff and ''yield''. >> >> Hmm, what''s it yielding to? Which template is it yielding to? There are both >> ''edit.html.erb'' and ''show.html.erb'' templates. > > It would be yielding to whatever template the controller action would > be using. In this case, that would be show.html.erb, since you''re in > the show action. > > -Dave > > -- > Dave Aronson, the T. Rex of Codosaurus LLC, > secret-cleared freelance software developer > taking contracts in or near NoVa or remote. > See information at http://www.Codosaur.us/.The part that is (probably) causing you to think something''s odd is that the view is actually processed first. The result and any ''content_for'' sections have been saved before the layout is processed. The main result of the view is inserted where the `yield` is processed and the result of a `content_for :foo` will be inserted if there is a `yield :foo`. -Rob Rob Biedenharn rob.biedenharn-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/4671F36A-5641-4CD3-B375-7251A87FCCA0%40gmail.com. For more options, visit https://groups.google.com/groups/opt_out.