Rails 3 render erb text

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

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