Hi folks,
My controller sets an instance variable (@item) which somehow contains a
different value in the layout than it does in the view.
The controller (items_controller), has this action:
def show
@item = Item.find(params[:id])
@owner = User.find(@item.owner_id)
return_to_main unless @item.status == $ITEM_STATUS_ACTIVE
@other_items_from_owner = @owner.available_items_for_rent([@item])
end
When I visit /items/show/123, it renders show.rhtml with all the correct
info for item #123 inside the page content. Good so far.
However, in my layout, I have:
<%= @item.name %>And when I visit /items/show/123, the browser title contains the name of
a different item! Now, if I rename the variable to something like
@item_foo (in all places in the controller/layout/view), then it shows
the CORRECT value in the title bar (and the page content). What could
possibly cause the variable’s contents to be different in the layout
than in the view? I’m not using any caching, by the way.