我有一个嵌套模型
resources :customers do
resources :readings
end
我现在想从客户的显示视图中访问我的 ../customerid/readings/new 视图。
在客户显示视图中,如何使用按钮调用新读数视图?
客户展示.html
<%- model_class = Customer -%>
<div class="page-header">
<h1><%=t '.title', :default => model_class.model_name.human %></h1>
</div>
<dl class="dl-horizontal">
<dt><strong><%= model_class.human_attribute_name(:name) %>:</strong></dt>
<dd><%= @customer.name %></dd>
<dt><strong><%= model_class.human_attribute_name(:customer_currency) %>:</strong></dt>
<dd><%= @customer.customer_currency %></dd>
<dt><strong><%= model_class.human_attribute_name(:payment_terms) %>:</strong></dt>
<dd><%= @customer.payment_terms %></dd>
<dt><strong><%= model_class.human_attribute_name(:phase_type) %>:</strong></dt>
<dd><%= @customer.phase_type %></dd>
<dt><strong><%= model_class.human_attribute_name(:billing_address) %>:</strong></dt>
<dd><%= @customer.billing_address %></dd>
<dt><strong><%= model_class.human_attribute_name(:first_name) %>:</strong></dt>
<dd><%= @customer.first_name %></dd>
<dt><strong><%= model_class.human_attribute_name(:last_name) %>:</strong></dt>
<dd><%= @customer.last_name %></dd>
<dt><strong><%= model_class.human_attribute_name(:mobile) %>:</strong></dt>
<dd><%= @customer.mobile %></dd>
<dt><strong><%= model_class.human_attribute_name(:email) %>:</strong></dt>
<dd><%= @customer.email %></dd>
</dl>
<div class="form-actions">
<%= link_to t('.back', :default => t("helpers.links.back")),
customers_path, :class => 'btn' %>
<%= link_to t('.edit', :default => t("helpers.links.edit")),
edit_customer_path(@customer), :class => 'btn' %>
<%= link_to t('.destroy', :default => t("helpers.links.destroy")),
customer_path(@customer),
:method => 'delete',
:data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) },
:class => 'btn btn-danger' %>
</div>