search for: recipe_for_chicken

Displaying 1 result from an estimated 1 matches for "recipe_for_chicken".

2006 Jul 30
8
Method_missing from Ruby for Rails book
...ng a problem getting this example from the book to work: class Cookbook attr_accessor :title, :author def initialize @recipes = [] end def method_missing(m, *args, &block) @recipes.send(m, *args, &block) end end cb = Cookbook.new cb << recipe_for_cake cb << recipe_for_chicken beef_dishes = cb.find_all {|recipes| recipe.main_ingredient == "beef" } I''m getting callable.rb:14: undefined local variable or method `recipe_for_cake'' for main:Object (NameError) so apparently method_missing is not working. Stuart