Template is Missing

I’m trying to learn to debug my Rails code. What types of errors cause
the “Template is Missing” error? Coming from a php environment, this
appears cryptic - but I’m betting it should be obvious to me.

Thanks in advance
—Michael

You probably have a method in your controller which has no corresponding
.rhtml, .rjs or .rxml (maybe?) file in views/your_controller_name.

You need at least one of those for each of your public controller
methods…
I think. If you’re writing methods where you won’t have any
corresponding
webpage, rjs scripts, etc then make a private method or a helper method.

I think that’s all right. I’m sure someone more knowledgeable than me
will
point me out if I’ve led you astray.

On 9/18/06, Michael S. [email protected]
wrote:

Posted via http://www.ruby-forum.com/.


Terry (TAD) Donaghe
http://www.tadspot.com

Terry D. wrote:

I think that’s all right. I’m sure someone more knowledgeable than me
will
point me out if I’ve led you astray.

Thanks for your info. I’m hoping to get several responses. I’m trying to
learn Rails, and some of the concepts are foreign to the “traditional”
way of doing thing.

Thanks again.
—Michael

Hi Michael,

Michael S. wrote:

I’m trying to learn Rails, and some of the concepts
are foreign to the “traditional” way of doing thing.

Depends on how far back your “tradition” goes :wink: A lot of the concepts
in
Rails were used in client/server computing. But if a person’s
experience
base didn’t predate the web (i.e., going on 8-10 years now), I imagine
concepts like MVC and solid OO language constructs could be new. Many
Rails
concepts aren’t so much new as they are new to the web development
domain.

Best regards,
Bill

Michael,

If you don’t already have it, I very strongly recommend that you buy the
2nd
Edition of Agile Web D. with Rails from
the pragmattic programmers. It’s currently only available as a PDF
purchase, but it’s well worth every penny and will teach you the
“traditional” ways to do rails, more or less.

Check here:

http://www.pragmaticprogrammer.com/titles/rails2/index.html

On 9/19/06, Bill W. [email protected] wrote:

in


Terry (TAD) Donaghe
http://www.tadspot.com

Michael S. wrote:

Bill W. wrote:

Depends on how far back your “tradition” goes :wink:

I go back to 1970. I’ve been in the field a LONG time.

Damn! That IS a LONG time :wink: I didn’t get started til '80.

It still begs the original question. What types of errors in
the code cause a “Template is missing” error.

The previous reply from Terry D. was correct with respect to what
causes the error: lack of a View. The default view that Rails looks
for is
one that has the same name as the controller action last executed in the
request/response cycle. The view used can be explicitly over-ridden in
the
controller action with either render or redirect_to. The render can
also be
used to tell Rails not to render anything at all which is especially
helpful
when you’re using Ajax to update the database incrementally.

The largest cause of the error for me has been fat-fingered typos.

I’ll also second Terry’s suggestion re: reading material.

hth,
Bill

Bill W. wrote:

Hi Michael,

Michael S. wrote:

I’m trying to learn Rails, and some of the concepts
are foreign to the “traditional” way of doing thing.

Depends on how far back your “tradition” goes :wink:

I go back to 1970. I’ve been in the field a LONG time.

A lot of the concepts
in
Rails were used in client/server computing. But if a person’s
experience
base didn’t predate the web (i.e., going on 8-10 years now), I imagine
concepts like MVC and solid OO language constructs could be new. Many
Rails
concepts aren’t so much new as they are new to the web development
domain.

I won’t argue that at all. While you CAN program objects in PHP, it is
kinda an add-on (I’m sure I’ll get yelled at for that - but it is). Ruby
starts out object oriented. It still begs the original question. What
types of errors in the code cause a “Template is missing” error. It
helps to have a starting point to debug.

Terry D. wrote:

Michael,

If you don’t already have it, I very strongly recommend that you buy the
2nd
Edition of Agile Web D. with Rails from
the pragmattic programmers. It’s currently only available as a PDF
purchase, but it’s well worth every penny and will teach you the
“traditional” ways to do rails, more or less.

I have it and can’t praise it high enough. It’s a mojor reference for me

  • not the only reference, of course, but an important one.

—Michael