Is there any way or example to export xls on rails 2.3.5 without using gems and something complicated?
I'm trying to export to xls with conditions by ejectuve_id that i selected i have this code
*********It s in my controller********
@search_ejecutive = params[:search_ejecutive].to_i
@search_status = params[:status_id].to_i
@list_ejecutives_comision = Ejecutive.find(:all)
ejecutive_ids = []
obj_user.ejecutives.each do |ejecutive|
@list_ejecutives_comision << Ejecutive.find(ejecutive.id)
end
@list_policies_search = Policy.deleted_is(0)
if params[:search_ejecutive].to_i!=0
@list_policies_search = @list_policies_search.ejecutive_id_is(@search_ejecutive)
end
ejecutive_ids = []
obj_user.ejecutives.each do |ejecutive|
ejecutive_ids << ejecutive.id
end
if !ejecutive_ids.blank?
@list_policies_search = @list_policies_search.ejecutive_id_in(ejecutive_ids)
end
@list_policies_search = @list_policies_search.deleted_is(0)
@list_policies = @list_policies_search.paginate(:page => params[:page], :per_page => 10)
And here i'm showing links that i tried
<% form_remote_tag :url=>{:action=>"generate_print_ejecutive_comercial"},:before=>"load_close('loading_search')",:success=>"load_off('loading_search')" do -%>
<label>Ejecutivo:</label>
<%= select_tag 'search_ejecutive',"<option value=\"\">Seleccione</option>"+options_for_select(@list_ejecutives_comision.collect {|t| [t.name.to_s+" "+t.lastname1.to_s,t.id]})%>
<input name="Buscar" value="Buscar" type="submit" /><span id="loading_search"></span>
<% end %>
<%= link_to("xls","http://localhost:3000/policy_management/policy/generate_print_ejecutive/generate_print_ejecutive.xls")%>
<%= link_to "xls", :controller=>"policy_management/policy",:action=>"generate_print_ejecutive",:format=>"xls" ,:search => params[:search_ejecutive],:page => params[:page] %>
<%= link_to 'Imprimir', :controller=>"policy_management/policy",:action=>"generate_print_ejecutive", :format=>"pdf" %>
<div id="table">
<%= render :partial=>"table2" %>
My :partial table2 is the result of @list_policies My teacher doesn't want doesn't want to reveal me the secret ,told me that the trick is
@list_policies
I tried to export manually and i tried this
@list_policies.find(:all,:conditions=>"ejecutive id = 1")
Somebody can help me with this, my teache told me that i need to export :search_ejecutive params
I will appreciate all help