开发者

Ruby on Rails UI Layer - managing divs

开发者 https://www.devze.com 2023-03-05 10:21 出处:网络
I have a ruby web application and I want to structure the UI layer to have a few templates made up of a number of various divs - something like header, footer, and other things that will repeat throug

I have a ruby web application and I want to structure the UI layer to have a few templates made up of a number of various divs - something like header, footer, and other things that will repeat throughout pages.

What I am wondering is: 1) Within the Ruby on Rails directory structure, where should these divs live? Somewhere under app/views/layouts ?

2) What is the syntax 开发者_如何学Cto import a div in order to still preserve the values of the variables set in the controllers?

Thanks!


You are referring to "Partials"

http://guides.rubyonrails.org/layouts_and_rendering.html (section 3.4)

Specifically, look at the locals option.

Layouts are usually in 'views' but you can change where they exist. views/layouts will work fine.

0

精彩评论

暂无评论...
验证码 换一张
取 消