Beginner s question

Hello,
I think I have logical problem about rails. I want to integrate my
plugin to my rails project. the plugin is kind of converter.the plugin
takes datas from database and convert into xml file.

I have a selection_tag that gets parameter from the user and passes it
to a controller.I want to access that data within the controller.
Converter needs parameter from the selection which is including the name
of the templates.

@templates_array = get_templates
“#{get_plugin_root}/public/converter/templates/”
converter_generate(sheet_id,date, output_path, template_path)
template_path =
“#{get_plugin_root}/public/converter/templates/#{params[:template]}.xml”

my selection is like ;
<%
templateOptions = “”
@templates_array.each do |i|
templateOptions = templateOptions + “#{i}”
end
%>

      <%=select_tag "template", templateOptions%>

the array takes name of the templates from folder and add them to
selection_tag.
my first question is how will I get the parameter from user. I can not
get it.
and second one is how will I add new option and value to this
selection.when I add option it creates the length of the array. I just
want to add single one.
by the way this is not used in form, it s not the object of form.

Hello,


QUESTION 1

my first question is how will I get the parameter from user. I can not
get it.
…bla…bla
by the way this is not used in form, it s not the object of form.

if it is not form, how selected template from user will be sent to your
controller? maybe you should add your own form_tag to execute that
select_tag. Or maybe it use JS or RJS or AJAX that has function as
form_tag or maybe it is sent to cookies or session, please check again.
Honestly, I never use this plug-in but i understand your problem is.


QUESTION 2

and second one is how will I add new option and value to this
selection.when I add option it creates the length of the array. I just
want to add single one.

Have you tried this?

<%
templateOptions = “”
@templates_array.each do |i|

templateOptions = templateOptions +
“#{i}” +
“#{your_description}”

end
%>

OR

<%
templateOptions = “”
@templates_array.each do |i|

templateOptions = templateOptions +
“#{i}” +
options_for_select([ “1”, “2”, “3”, “4”], “1”)
end
%>

I hope it can answer your doubtful. Good Luck.

~~~~~**~~~~~
Reinhart Ariando
YM : Booking2Heaven
WEB : http://teapoci.blogspot.com

<%- content_for :head do -%>
<%= stylesheet_link_tag ‘prototype-ui’ %>
<%= stylesheet_link_tag ‘actions/project_sheet’ %>
<%= javascript_include_tag ‘vendor/prototype-ui/window’ %>
<%= javascript_include_tag ‘vendor/jquery’ %>

<%= javascript_include_tag ‘vendor/jquery.flot.js’ %>
<%= javascript_include_tag ‘prototype-ui’, :charset => ‘UTF-8’ %>
<%= javascript_include_tag ‘project_lock’, :charset => ‘UTF-8’ %>
<%= javascript_include_tag :project_sheet, :charset => ‘UTF-8’ %>

<%- end -%>

     <%=h _('-- 設定メニュー --') %> <%=h _('Staff') %> <%=h _('Shift') %> <%=h WO::Util.tree_child + _('高度な設定') %> <%=h WO::Util.tree_child + (_('%sの作成') % _('Label')) %> <%=h WO::Util.tree_last_child + _('業務バインド') %> <%=h _('Location') %> <%=h _('Role') %> <%=h _('Skill') %> <%=h _('Task') %> <%=h _('t project custom count') %> <%=h _('t project config') %> <%=h _('%sã¸ã®åæ˜ ') % _('Preset') %> <%=h _('%sのロード') % _('Preset') %>
<%=h _('対象サイト') %> <%=h current_project.site.name %> <%=h _('TProject|Name') %> <%=h current_project.name %>
    <%= print_tab _('t project work sheet'), nil, false, :id => 'tab_work_sheet' %> <%= print_tab _('Calendar'), nil, false, :id => 'tab_calendar_sheet' %> <%= print_tab _('Staff'), nil, false, :id => 'tab_staff_sheet' %> <%= print_tab _('Demand'), nil, false, :id => 'tab_demand_sheet' %>
    <%= print_tab _('Optimize') + ' >>', { :controller => '/project/optimize', :ac => @access_code }, false, :id => 'tab_optimize' %>
<%= render :partial => 'work_sheet' %> <%= render :partial => 'calendar_sheet' %> <%= render :partial => 'staff_sheet' %> <%= render :partial => 'demand_sheet' %>
<%- if current_account.system? || current_account.enterprise? -%> <%- end -%>

this is my view page. I tried to add new div and form in it but this
time it gives router error.
resources = {
:custom_count => { :collection => { :sort => :get, :update_sort =>
:put } },
:location => { :collection => { :sort => :get, :update_sort =>
:put } },
:role => { :collection => { :sort => :get, :update_sort =>
:put } },
:rule => { :collection => { :update_assignments => :put },
:member => { :update_label => :put } },
:rule_label => {},
:shift => { :collection => { :sort => :get, :update_sort =>
:put } },
:shift_label => {},
:skill => {},
:staff => { :collection => { :sort => :get, :update_sort =>
:put } },
:task => {},
}

resource = {
:config => {},
:role_shift => {},
:shift_config => {},
}

resources.each do |entity, options|
map.resources entity.to_s.pluralize, {
:controller => “preset_project/#{entity}”,
:name_prefix => ‘t_project_’,
:path_prefix =>
‘/:enterprise_code/:m_hierarchy_id/:t_project_id’,
:requirements => { :m_hierarchy_id => /\d+/, :t_project_id =>
/\d+/ },
}.merge(options)

map.resources entity.to_s.pluralize, {
  :controller   => "preset_project/#{entity}",
  :name_prefix  => 't_preset_',
  :path_prefix  => '/:enterprise_code/:m_hierarchy_id',
  :requirements => { :m_hierarchy_id => /\d+/ },
}.merge(options)

end

resource.each do |entity, options|
map.resource entity, {
:controller => “preset_project/#{entity}”,
:name_prefix => ‘t_project_’,
:path_prefix =>
‘/:enterprise_code/:m_hierarchy_id/:t_project_id’,
:requirements => { :m_hierarchy_id => /\d+/, :t_project_id =>
/\d+/ }
}.merge(options)

map.resource entity, {
  :controller   => "preset_project/#{entity}",
  :name_prefix  => 't_preset_',
  :path_prefix  => '/:enterprise_code/:m_hierarchy_id',
  :requirements => { :m_hierarchy_id => /\d+/ },
}.merge(options)

end

Project::*

%w( optimize report sheet ).each do |controller|
map.connect
“:enterprise_code/:m_hierarchy_id/:t_project_id/#{controller}/:action/:id”,
:controller => “project/#{controller}”,
:requirements => { :m_hierarchy_id => /\d+/, :t_project_id =>
/\d+/ }
end

Preset::*

map.connect ‘:enterprise_code/:m_hierarchy_id/:controller/:action’,
:requirements => { :m_hierarchy_id => /\d+/,
:controller => %r!preset/top! }

Site::*

%w( demand project schedule ).each do |controller|
map.connect
“:enterprise_code/:m_hierarchy_id/#{controller}/:action/:id”,
:controller => “site/#{controller}”,
:requirements => { :m_hierarchy_id => /\d+/ }
end

Master::*

resources = {
:account => {},
:event => {},
:hierarchy => {},
}

resource = {
:system_constant => {},
}

resources.each do |entity, options|
map.resources entity.to_s.pluralize, {
:controller => “master/#{entity}”,
:name_prefix => ‘m_’,
:path_prefix => ‘/:enterprise_code/:m_hierarchy_id’,
:requirements => { :m_hierarchy_id => /\d+/ },
}.merge(options)
end

resource.each do |entity, options|
map.resource entity, {
:controller => “master/#{entity}”,
:name_prefix => ‘m_’,
:path_prefix => ‘/:enterprise_code/:m_hierarchy_id’,
:requirements => { :m_hierarchy_id => /\d+/ }
}.merge(options)
end

%w( enterprise_config ).each do |controller|
map.connect
“:enterprise_code/:m_hierarchy_id/#{controller}/:action/:id”,
:controller => “master/#{controller}”,
:requirements => { :m_hierarchy_id => /\d+/ }
end

Global::*

%w( password queue ).each do |controller|
map.connect “:enterprise_code/#{controller}/:action/:id”,
:controller => “global/#{controller}”
end

Login

map.connect ‘:enterprise_code/:controller/:action’,
:controller => ‘login’,
:enterprise_code => ‘default’,
:requirements => { :controller => /login/ }

Stylesheets, Javascripts, Monitor

map.connect ‘stylesheets/actions/:action.css’, :controller =>
‘stylesheets’
map.connect ‘stylesheets/:action.css’, :controller =>
‘stylesheets’
map.connect ‘javascripts/:action.js’, :controller =>
‘javascripts’
map.connect ‘monitor/:action’, :controller =>
‘monitor’
end

router settings are quite complex for me, I couldnt understand how to
add button and selection to my page.
I run the plug in without selection on this page but that time I had
tiny problem like, the converter created output file but didnt redirect
to main page and didnt ask me save as option. even it runs the converter
I need to get the parameter from selection…

hello,

This is not beginner s question topic any more (^-^). Do you have yahoo
messenger? because i need to read your script in orginal file. Here your
script is untidy.

~~~~~**~~~~~
Reinhart Ariando
Yahoo Messenger ID : Booking2Heaven
WEB : http://teapoci.blogspot.com

Visit Indonesia 2008 wrote:

hello,

This is not beginner s question topic any more (^-^). Do you have yahoo
messenger? because i need to read your script in orginal file. Here your
script is untidy.

~~~~~**~~~~~
Reinhart Ariando
Yahoo Messenger ID : Booking2Heaven
WEB : http://teapoci.blogspot.com

let me download it. may I add you to my list.we may discuss there.