深入理解Rails应用:视图、控制器与表单验证
1. 视图的实现
在Rails应用中,视图的基本外观和感觉通常通过RHTML文件来实现。以一个特定的应用为例,其基本的外观在 index.rhtml 文件中实现,代码如下:
<div class="topper"></div>
<div class="staxlist">
<%= link_to “New Stack”, :controller => ‘stack’, :action => ‘create’ %>
<% if ((@stacks == nil) || @stacks.empty?) %>
<%= render :partial => ‘shared/voidspace’, :locals => { :displaytext => “You have no Stax. Try creating one” } %>
<% else %>
<%= render :partial => ‘stack/stacklist’, :locals => {:stacks => @stacks} %>
<% end %>
</div>
<div class="topper"></div>
<div id="timeline" class="timeline">
<!-- conta
超级会员免费看
订阅专栏 解锁全文
67

被折叠的 条评论
为什么被折叠?



