Index.erb vs rhtml


#1

I am a total Ruby/RoR n00b having just started reading the ‘Ruby on
Rails Bible’ book two days ago. I’ve been trying to work out through
the introductory ‘Your first ruby on rails application’ section, but
I’ve run into problems already!

The book goes on about creating the view templates and naming them
with the *.html.erb extension, but I get run-time errors when I use
that extension. I have seen some other RoR sites that use the *.rhtml
extension so I tried that instead and that seemed to fix my problem.

But isn’t that the old rails file naming convention? I want to use the
proper/new convention but I’m not sure what I need to do … perhaps
update Ruby or Rails or ??? on my computer? Or is it something I have
misconfigured?

I’m developing on a Mac and these are the versions of Ruby and RoR I
currently have installed:

ruby 1.8.6 (2008-08-11 patchlevel 287) [universal-darwin9.0]
Rails 2.3.2

If this helps, when I run “gem list” I get this output:

*** LOCAL GEMS ***

actionmailer (2.3.2, 1.3.6)
actionpack (2.3.2, 1.13.6)
actionwebservice (1.2.6)
activerecord (2.3.2, 1.15.6)
activeresource (2.3.2)
activesupport (2.3.2, 1.4.4)
acts_as_ferret (0.4.1)
capistrano (2.0.0)
cgi_multipart_eof_fix (2.5.0, 2.2)
daemons (1.0.9, 1.0.7)
dnssd (0.6.0)
fastthread (1.0.1, 1.0)
fcgi (0.8.7)
ferret (0.11.4)
gem_plugin (0.2.3, 0.2.2)
highline (1.2.9)
hpricot (0.6)
libxml-ruby (0.9.5, 0.3.8.4)
mongrel (1.1.4, 1.0.1)
needle (1.3.0)
net-sftp (1.1.0)
net-ssh (1.1.2)
rails (2.3.2, 1.2.6)
rake (0.8.7, 0.7.3)
RedCloth (3.0.4)
ruby-openid (1.1.4)
ruby-yadis (0.3.4)
rubynode (0.1.3)
sqlite3-ruby (1.2.1)
termios (0.9.4)

Any help would be greatly appreciated!


#2

Can you post the errors you are getting?

On 5/25/09, rails_n00b removed_email_address@domain.invalid wrote:

extension so I tried that instead and that seemed to fix my problem.
Rails 2.3.2
activesupport (2.3.2, 1.4.4)
hpricot (0.6)
rubynode (0.1.3)
sqlite3-ruby (1.2.1)
termios (0.9.4)

Any help would be greatly appreciated!


Steve Shepherd
Mob:+64 (0) 27 4338154
Email: removed_email_address@domain.invalid
Analyst


#3

Here is an example of the type of error I am getting when my view
templates are *.html.erb files:

Showing app/views/contact/show.rhtml where line # raised:
No such file or directory - /Users/kevin/dev/Ruby/sandbox/
contactlist/app/views/contact/show.rhtml

Its like its expecting my views to be .rhtml files, not .html.erb
files


#4

Its like its expecting my views to be .rhtml files, not .html.erb
files

Cleanup your rubygems, you have a very old version installed, and maybe
in your Rails. Define in environment.rb:

RAILS_GEM_VERSION = ‘2.3.2’ unless defined? RAILS_GEM_VERSION