NoMethodError [depot]


I'm a newbie here and to RoR, so forgive me if this is an over simple question.

I'm running through the PragProg Agile Web Development with Ruby on Rails, and I've got stuck on the Depot application.

When trying to view the 'store' I get this error: NoMethodError in Store#index.rhtml

Hi Angela,

if you didn't mistype anything in product.rb and store_controller.rb, I'd say there's a problem with the db. Look in depot/log/development.log for any errors and check the db whether the required tables exists and are populated.

Best regards,


Line 3 calls for @products which is nil at the time in the index view, meaning that there are no products in your variable. Do you have something that populates the instance variable @products in your StoreController#index method?

thanks both for this

this problem was actually caused by: <%=@content_for_layout%>

being missing from store.rhtm

it's all working just fine now - i just have much less hair!

Thanks! A


Glad you found it.

With some discussion about recently about depricated usages, with warnings and such available in plugins etc, the usage of @content_for_layour is depricated.

Instead you should use

<%= yield %> or <%= yeild :layout %>