Hi
I'm a bit stumped as to how to pass options to these helpers:
# helpers def generate_html(form_builder, method, options = {}) options[:object] ||= form_builder.object.class.reflect_on_association(method).klass.new debugger options[:partial] ||= method.to_s.singularize options[:form_builder_local] ||= :f form_builder.fields_for(method, options[:object], :child_index => 'NEW_RECORD') do |f| render(:partial => options[:partial], :locals => { options[:form_builder_local] => f }) end end
def generate_template(form_builder, method, options = {}) debugger escape_javascript generate_html(form_builder, method, options = {}) end
The first problem I have is I cannot escape the quotation mark inside the option hash, backslash does not work somehow. # view - this does not work <%= "var keyword='#{generate_template(form, :keywords, {:partial => 'nested_shared/keyword'})}\'" %>
Second problem is the option is not passed between the two helpers # view <%= "var keyword='#{generate_template(form, :keywords, {:partial => :test})}\'" %>
I can see the option in generate template but it's not passed onward to generate html.
Help would be much appreciated