Hi Rails Developers
I want to select template from my folder and add it like a parameter.
the plugin needs parameter like a template_path. I want to supply it
from selection and selection get datas from folder.
template_path =
“#{get_plugin_root}/public/converter/templates/#{params[:template]}.xml”
output_path = “#{RAILS_ROOT}/public/converter/output/output.xml”
sheet_id=current_project.work_sheet.id
date= current_project.from_date.to_s
converter_generate(sheet_id,date, output_path, template_path) #this is
method in my plugin.
I have a array to get templates
@templates_array = get_templates
“#{get_plugin_root}/public/converter/templates/”
till here looks no problem but when I pass to view page it gives me
error.
<% templateOptions = “”
@templates_array.each do |i|
templateOptions = templateOptions + “#{i}”
end
<%=select_tag "template", templateOptions %>
error : undefined method `each’ for nil:NilClass
could you pls tell me where the error is ?
and also I tried to add new value in selection but couldnt do it. it
creates 4 csv option…
<% templateOptions = “”
@templates_array.each do |i|
templateOptions = templateOptions + “#{i}csv”
end
thanks for any help or comments