Article:
  Rolling with Ruby on Rails
Subject:   undefined method 'title'
Date:   2006-10-04 14:44:46
From:   ozymandias
After i added the 'list' method in 'recipe_controller.rb' and created the 'list.rhtml' file, i got the following error message when trying to connect to '/recipe/list':


undefined method `title' for #<Recipe:0x308c7bd0>


Is that method no longer a part of ruby, or what?

Full Threads Oldest First

Showing messages 1 through 6 of 6.

  • undefined method 'title'
    2007-02-05 05:52:36  fcamel [View]

    I got the same problem, and I found the problem is in "recipe_controller.rb"

    of the method "edit", I type

    @recipe = Recipe.find_all(@params["id"])
    ^^^^^^^^

    rewrite this as "find(@params["id"])", it works.
  • undefined method 'title'
    2006-10-08 01:05:49  benjaminzsj [View]

    I got a similar problem, too.
    undefined method `title' for #<Array:0xb75abe2c>
    It's with my Ubuntu 6.10. Is there something wrong with my db setup?
    • undefined method 'title'
      2006-10-08 01:09:14  benjaminzsj [View]

      Sorry, forgot to mention it occurred when I modify the edit.rhtml and I copied code from the article.
      • Curt Hibbs photo undefined method 'title'
        2006-10-09 08:09:44  Curt Hibbs | O'Reilly AuthorO'Reilly Blogger [View]

        This method is generated dynamically based on the column names in your receipes tables. Check the spelling in you database and make sure it matches the spelling in you list.rhtml file.
        • Curt Hibbs photo undefined method 'title'
          2006-10-09 08:14:53  Curt Hibbs | O'Reilly AuthorO'Reilly Blogger [View]

          It would be nice if I knew how to spell, too! :-)

          That should have read "in your recipes table."
  • Curt Hibbs photo undefined method 'title'
    2006-10-04 18:21:38  Curt Hibbs | O'Reilly AuthorO'Reilly Blogger [View]

    I think you've got a mistake in your list.rhtml file. Double-check it.