Ruby on Rails 结构体
示例
当Rails遵循MVC模式Views时,您的“模板”就是您的操作所在。
假设您有一个控制器articles_controller.rb。对于此控制器,您将在视图中有一个名为的文件夹app/views/articles:
app
|-- controllers
| '-- articles_controller.rb
|
'-- views
'-- articles
| |- index.html.erb
| |- edit.html.erb
| |- show.html.erb
| |- new.html.erb
| '- _partial_view.html.erb
|
'-- [...]这种结构允许您为每个控制器都有一个文件夹。在控制器中调用动作时,将自动呈现适当的视图。
//article_controller.rb class ArticlesController < ActionController::Base def show end end //show.html.erb <h1>My show view</h1>
热门推荐
10 儿子立冬祝福语简短独特
11 对当兵的祝福语简短
12 侄儿高考试祝福语简短
13 伴郎红包祝福语朋友简短
14 媳妇生日简短祝福语朋友
15 公司年会祝福语简短最好
16 元旦感恩祝福语简短大全
17 红包祝福语简短10字
18 周六早晨祝福语简短