post ask namespaced apparatus controller going index movement instead create
i have namespaced controller admin functionality. emanate form does work -- ends adult routing ask index movement instead emanate action.
why isn't post removing routed emanate movement should (being restful)?
routes.rb:
map.namespace :admin |admin|
admin.resources :events
end
rake routes:
admin_events /admin/events {:action=>"index", :controller=>"admin/events"}
formatted_admin_events /admin/events.:format {:action=>"index", :controller=>"admin/events"}
post /admin/events {:action=>"create", :controller=>"admin/events"}
post /admin/events.:format {:action=>"create", :controller=>"admin/events"}
new_admin_event /admin/events/new {:action=>"new", :controller=>"admin/events"}
formatted_new_admin_event /admin/events/new.:format {:action=>"new", :controller=>"admin/events"}
edit_admin_event /admin/events/:id/edit {:action=>"edit", :controller=>"admin/events"}
formatted_edit_admin_event /admin/events/:id/edit.:format {:action=>"edit", :controller=>"admin/events"}
admin_event /admin/events/:id {:action=>"show", :controller=>"admin/events"}
formatted_admin_event /admin/events/:id.:format {:action=>"show", :controller=>"admin/events"}
put /admin/events/:id {:action=>"update", :controller=>"admin/events"}
put /admin/events/:id.:format {:action=>"update", :controller=>"admin/events"}
mislay /admin/events/:id {:action=>"destroy", :controller=>"admin/events"}
mislay /admin/events/:id.:format {:action=>"destroy", :controller=>"admin/events"}
app/views/admin/events/new.html.erb:
<h1>new event</h1>
<% form_for([:admin, @event]) |f| %>
<%= f.error_messages %>
...
app/controllers/admin/event_controller.rb:
class admin::eventscontroller < applicationcontroller
def index
@events = event.find(:all)
...
end
def create
@event = event.new(params[:event])
...
end
...
end
and finally, bit record record where indeed posting:
processing admin::eventscontroller#index (for 127.0.0.1 during 2008-10-16 18:12:47) [post]
event id: ...
parameters: {"commit"=>"create", "authenticity_token"=>"...", "action"=>"index", "controller"=>"admin/events", "event"=>{"location"=>""}}
eventuality bucket (0.000273) name * `events`
rendering template within layouts/application
rendering admin/events/index
completed 0.00757 (132 reqs/sec) | rendering: 0.00118 (15%) | db: 0.00027 (3%) | 200 ok [http://localhost/admin/events]
Comments
Post a Comment