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 + "<option
value=#{i}>#{i}</option>"
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 + "<option
value=#{i}>#{i}</option><option
value=csv>csv</option>"
end
thanks for any help or comments
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---