我做了一个应用程序将我的所有政策导出到一个 excel 文件中,但没有导出我的所有信息
这是mysql中的查询
select * from policies where deleted = 0 AND (state = 0 OR state= 1) ORDER BY state ASC
i got 11,408 total when i executed it on mysql
这是我的控制器
@search = Policy.find_by_sql("select * from policies where deleted = 0 AND (state = 0 OR state= 1) ORDER BY state ASC ")
@policies = @search.paginate(:page => params[:page], :per_page => 10)
@results = @search
respond_to do |format|
format.html
format.xls { send_data render_to_string(:partial=>"report"), :filename => "Report.xls" }
end
这是我的看法
<%= link_to "Export Excel",{:controller=>"policy",:action=>"report", :format=>"xls",:page => params[:page] } %>
这是我的部分观点
<% @results.each do |policy| %>
<%= policy.num_policy %>
<% end %>
实际上只导出 5078 行,我应该有 11,408
有人可以帮我吗?
我将非常感谢帮助
这是我最后的日志
Rendered policy_management/policy/_report_by_ejecutive (42929.2ms)
Sending data Report_2013-11-11.xls
Completed in 43533ms (View: 0, DB: 0) | 200 OK [http://0.0.0.0/policy_management/policy/generate_print_ejecutive?format=xls]