# Newbea Restful Route ?/

**URL:** <https://www.ruby-forum.com/t/newbea-restful-route/135124>\
**Category:** Rails\
**Created:** [April 18, 2008, 6:53am UTC](https://www.ruby-forum.com/t/newbea-restful-route/135124 "2008-04-18T06:53:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![casid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/47e85d/32.png) [@casid](https://www.ruby-forum.com/u/casid)\
**Post date:** [April 18, 2008, 6:53am UTC](https://www.ruby-forum.com/t/newbea-restful-route/135124/1 "2008-04-18T06:53:52Z")

</div>

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
