You are here: Forums General Discussion Rails 2.0 view template format...
Posted in Forums : General Discussion
Authority 0
Posting Rating 18
Sign in to rate this post
|
I recently tried Rails 2.0 using InstantRails 2.0. When I tried scaffolding to make a quick test I was surprised to see that the template files for the views have a different extension. It now has the .html.erb extension instead of the .rhtml. What’s the reason for this? |
Authority 37
Posting Rating 80
Sign in to rate this post
|
the name is now split into two suffixes to determine the content type you’re responding to and the renderer you’re using in this case .html.erb means you’re returning html and using ERB to render the template for example, if you were using HAML your template would be named .html.haml |
Authority 0
Posting Rating 18
Sign in to rate this post
|
I see. That’s why when I viewed the methods in the generated controller all of the methods have a respond_to statement. |
Authority 37
Posting Rating 80
Sign in to rate this post
|
It makes it easier to determine what content type and renderer is being used. It also means that if you setup your own content types, you’d easily be able to setup the associated templates. For example, there’ve been a fair few posts around setting up a content type for the iphone – the associated templates for these are index.iphone.erb for example. Akita has a good post about features in Rails 2 on his blog |
General Discussion : Is Jruby Supports all the features same as ruby on rail
General Discussion : [ANN] Book released "Aptana RadRails: An IDE for Rails Development"
General Discussion : Template Management in rails
General Discussion : Blogs in rails
General Discussion : Quality version control and deployment...?
General Discussion : Math Learning site in Rails
General Discussion : Funny RailsConf MVC videos from RailsEnvy/FiveRuns
General Discussion : *.isonrails.com - Rails Playground online
General Discussion : host2day.com not for RoR
General Discussion : Great Rails Resource...