Hello RoR Developers,
I have tiny problem with router, could you check the code to help me
finding issue.
routes.rb
resources = {
:rule => { :collection => { :update_assignments => :put ,
:details => :put }, :member => { :update_label => :get} },
}
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
controller:
require ''csv''
class PresetProject::RuleController < PresetProject::BaseController
def details
CSV::Writer.generate(output = "" ) do |csv|
Order.find(:all).each do |order|
csv << [@t_project_rule]
end
end
send_data(output,
:type => content_type,
:filename => "preview.csv" ,
:disposition => ''attachment'',
:streaming => ''true'',
:buffer_size => 4096)
end
rhtml codes
<%= button_to "prev" ,
:controller=>"preset_project/rule",
:action=>"details", :method => :put %>
error message :
Only get, put, and delete requests are allowed.
so how will I run my details method? I can not trigger.
thanks
--
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
-~----------~----~----~----~------~----~------~--~---