ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  Rolling with Ruby on Rails
Subject:   Ruby phantoms
Date:   2005-06-04 05:47:15
From:   Meindert
After reading this appetizer Rolling with Ruby on Ralis last week, I immediately started downloading all stuff and building the part one application. Without much knowledge of Ruby I'm afraid.
As could be expected, it ended with a undefined method recipe.category.name in list.rhtml, after a new recipe was added. At that moment, I did no further reading (stupid me), but tried to repair it by myself, adding ... if defined? recipe.category.name to it. That did not work, because defined? recipe.category.name always returns nil, and defined? recipe.category always returns method. I added ... unless recipe.category.nil? instead, which did the trick and looks more elegant.
But it leaves me puzzled: recipe.category and recipe.category.name, what kind of Ruby things are they?

1 to 1 of 1
  1. Curt Hibbs photo Ruby phantoms
    2005-06-04 08:17:38  Curt Hibbs | O'Reilly AuthorO'Reilly Blogger [View]

    • Ruby phantoms
      2005-06-06 11:58:38  Meindert [View]

1 to 1 of 1