Question about nested views and layouts

Hi,

I’m new to RoR, and I’m confused on how nested views work. This is
what I have set up:

/store/products_controller.rb
/store/services_controller.rb

/views/layouts/products.rhtml
/views/layouts/services.rhtml
/views/layouts/store.rhtml

/views/store/product/edit.rhtml (and new.rhtml, list.rhtml, etc
created by scaffold)
/views/store/service/edit.rhtml (also created by scaffold)

So when I change the “master” page format in /views/layouts/
products.rhtml, it should be reflected on views/store/product/
list.rhtml, right? I added some links and “hello world” in but
nothing showed up. I went to view source on the ‘list’ page and I
don’t even see the or tags in products.rhtml. Of
course, modifications in the views itself is reflected correctly. I’m
wondering if I’m even doing this correctly. Any advice is
appreciated.

BTW, I generated scaffold like the following:

script/generate scaffold product store/products
script/generate scaffold service store/services

Thanks in advance.

This is a rather hacky way to do things if all you are trying to do is
put “store” in the url. Instead, create the controllers and views
normally (don’t nest them under “store”) and set up a route for your
application in routes.rb (config/routes.rb) to expect “store”.

Good Luck :slight_smile:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs