Jump to content


Chapter 8; File Upload Form; Name Error

  • Please log in to reply
2 replies to this topic

#1 abbyworld


    New Member

  • Members
  • Pip
  • 1 posts

Posted 30 May 2009 - 10:23 PM

I'm very new to Rails, so please bear with me.

I'm getting a name error when I try to look at my show view in my browser. I followed the book's instructions verbatim, I even included the change to the code on page 124 as noted in the errata. Any tips on what I may be doing wrong here?

Here's the error that I'm getting:

undefined local variable or method `extension' for #<Theater:0x24fa2d4>

Extracted source (around line #4):

<table width="730" border="0" align="center" id="show_table">
2: <tr>
3: <td rowspan="6" align="left" valign="top">
4: <% if @theater.has_photo? %>
5: <%= image_tag @theater.photo_path %>
6: <% else %>
7: No photo.

Note: "theater" is the name of the table that I'm inserting the extension column into; it takes the place of "person" in the book example.

Also, I'm running Rails on a Mac and editing with Xcode, if that helps.

Thanks very much!

#2 simonstl


    Active Member

  • O'Reilly Editor
  • PipPip
  • 35 posts

Posted 01 June 2009 - 06:37 AM

It's a little tricky, because you've added it to a different model, but we're guessing that you probably haven't run the migration that adds the extension field to your Theater model.

Could you take a look at that and let us know?


#3 Jeename


    New Member

  • Members
  • Pip
  • 1 posts

Posted 21 November 2010 - 09:41 PM

For all such type of name errors i am using a very handy tool which is available at http://pathtoodeep.com ,it will resolve this error in just a second

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users