我在我的 Rails 3 应用程序中提供了一个名为报告的控制器。控制器的索引部分如下所示:
def index
#@reports = Report.all
@clinical_income_by_month = Clinical.income_by_month
@clinical_income_by_employee = Clinical.income_by_employee
@clinical_income_by_vet = Clinical.income_by_vet
@consult_consult_times = Consult.consult_times
@clinical_healthplan_high_spenders = Clinical.healthplan_high_spenders
respond_to do |format|
format.html # index.html.erb
format.json { render json: @reports }
end
end
index.html.erb 代码如下所示:
<h6><b>Financial Reports</b></h6>
<dl class="vertical">
<dd><a href="/income_by_month">Income by Month</a></dd>
<dd><a href="/income_by_employee">Income by Employee</a></dd>
<dd><a href="/income_by_vet">Income by Vet</a></dd>
</dl>
我已将最初全部在 jQuery 选项卡下的 index.html.erb 中的报告拆分为它们自己的页面。
加载各个报告的链接的最佳方法是什么?目前,如果我访问链接或手动输入http://0.0.0.0:3000/reports/income_by_month.html我会收到未知页面错误。
任何指针将不胜感激!