Hi all, I have a file called configure.text.erb in views/<class>/ directory. Why does render ''configure.text.erb'' actually work? How does render know that this is plain text? Does it assume this due to the text.erb ending? How does this actually all plumb together? And would be the difference in the between using the following two to generate html in a controller? Am I correct in assuming that the first one will only generate html if asked for, the other will generate it all the time? Does something in format.html call "render" ? respond_to do |format| format.html # configure.html.erb end and using render ''configure.html.erb'' Rails does a whole lot of great things, but at the moment the magic is overwhelming me. Trying to work out how all this is connected is really confusing. Thanks for any light you can shed on this. Best regards, Andrew -- 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.
On Sun, Apr 17, 2011 at 6:17 PM, Andrew Miehs <andrew-64B0ZDxNVfizQB+pC5nmwQ@public.gmane.org> wrote:> Hi all, > > I have a file called configure.text.erb in views/<class>/ directory. > > Why does > render ''configure.text.erb'' > actually work? > > How does render know that this is plain text? Does it assume this due to > the text.erb ending? > > How does this actually all plumb together? > > And would be the difference in the between using the following two to > generate html in a controller? > Am I correct in assuming that the first one will only generate html if > asked for, the other will generate it all the time? > Does something in format.html call "render" ? > > respond_to do |format| > format.html # configure.html.erb > end > > and using > > render ''configure.html.erb'' > > Rails does a whole lot of great things, but at the moment the magic is > overwhelming me. > Trying to work out how all this is connected is really confusing. > > > Thanks for any light you can shed on this. > >I think you will find these links helpful in answering your questions: How does respond_to work in Rails controllers? http://www.tokumine.com/2009/09/13/how-does-respond_to-work-in-the-rails-controllers/ Layouts and Rendering in Rails http://guides.rubyonrails.org/layouts_and_rendering.html B. -- 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.
On Mon, Apr 18, 2011 at 2:59 PM, Bryan Crossland <bacrossland-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:> On Sun, Apr 17, 2011 at 6:17 PM, Andrew Miehs <andrew-64B0ZDxNVfizQB+pC5nmwQ@public.gmane.org> wrote: > >> Why does >> render ''configure.text.erb'' >> actually work? >> >> How does render know that this is plain text? Does it assume this due to >> the text.erb ending? >> >> How does this actually all plumb together? >> >> >> I think you will find these links helpful in answering your questions: >> >> How does respond_to work in Rails controllers? >> >> http://www.tokumine.com/2009/09/13/how-does-respond_to-work-in-the-rails-controllers/ >> >> Layouts and Rendering in Rails >> http://guides.rubyonrails.org/layouts_and_rendering.html >> >> B. > >Perfect - thankyou! Andrew -- 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.