Rails 3 render erb text

Hi all,

I have a file called configure.text.erb in views// 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

On Sun, Apr 17, 2011 at 6:17 PM, Andrew M. [email protected] wrote:

end
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.

On Mon, Apr 18, 2011 at 2:59 PM, Bryan C.
[email protected]wrote:

B.

Perfect - thankyou!

Andrew

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs