You are here: Forums General Discussion Rails 2.0 view template format...
Posted in Forums : General Discussion
Authority 0
Posting Rating 28
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 83
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 28
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 83
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 : May 13th - Toronto Ruby on Rails Project Night Returns
General Discussion : Agile Web Development with Rails, 3rd Edition released!!
General Discussion : www.rubyonrails.org was Hijacked /Hacked ???
General Discussion : Data tracking and site statistics
General Discussion : Heroku Invite
General Discussion : mod_rails
General Discussion : Orphan start-up - suggestions?
General Discussion : Where to find RoR contractors in Chicago?
General Discussion : Promote a website / project
General Discussion : very basic question about what is possible with ROR