Newbea Restful Route ?/

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs