Displaying 3 results from an estimated 3 matches for "dish_id".
Did you mean:
disc_id
2010 Feb 14
2
has_many :through eager loading only loading one record
...HOW FIELDS FROM `dish`
Dish Load (0.4ms) SELECT * FROM `dish` WHERE (`dish`.`id` = 209)
app/controllers/tags_controller.rb:5:in `index''
Notice that in DishTagging Load, the first foreign key in the list is
58. As it turns out, there is only one DishTagging witth tag_id 58,
and its dish_id is 209. Now look at Dish Load: it''s loading dish 209
and nothing else.
So, this leads me to believe that only the first related record is
being eager-loaded. Sure enough, when I iterate, Active Record loads
each dish individually except for dish 209.
Any thoughts on why this is happening...
2006 Feb 27
2
Find not working
Hello all.
I have the following code (taken from the depot tutorial then modified)
def add_dish( dish, type, qnty )
item = @items.find {|i| i.dish_id == dish.id && i.type == type }
if item
item.quantity += qnty.to_i
else
if type == ''Fresh''
item = Fresh.for_dish(dish)
else
item = Frozen.for_dish(dish)
end
item.order_id = 1
item.quantity = qnty.to_i
@items...
2006 Nov 14
3
messed-up habtm relationship
...w when i access my_dish.ingredients, i get a list of what looks like
Ingredient objects, but the but they don''t have the right attributes:
#<Ingredient:0x29d3544 @readonly=true, @attributes={"name"=>"Chicken",
"ingredient_id"=>"36", "dish_id"=>"1", "id"=>"1"}>
The join table''s columns ''dish_id'' and ''ingredient_id'' show up, and the
id is the id of the row in the join table, not the one of the ingredient
(Chicken).
I noticed this because the foll...