Admin Controller of Resource Links to Regular Controller of Resource ?

31 views
Skip to first unread message

Vivek Sampara

unread,
Jan 9, 2013, 12:56:59 PM1/9/13
to hobo...@googlegroups.com
Hi guys, 

Found something a bit weird today. 

What i wanted - Hospital Resource not available to normal users but only available to Admin
What i did - Deleted app/controllers/hospitals_controller.rb ( auto generated ) 
                  Created app/controllers/admin/hospitals_controller.rb 


/admin/hospitals/new - works
/admin/hospitals/1/edit - works
/admin/hospitals/1/delete - works
/admin/hospitals/ - Crashes

undefined method `hospital_path' for #<#<Class:0x9d0a51c>:0x9d1dc48>

dryml (2.0.0.pre7) lib/dryml/template_environment.rb:642:in `method_missing'
actionpack (3.2.10) lib/action_dispatch/routing/polymorphic_routes.rb:129:in `polymorphic_url'
actionpack (3.2.10) lib/action_dispatch/routing/polymorphic_routes.rb:135:in `polymorphic_path'


Its very easy to reproduce , so im not putting up the full stack trace. 

Later on I put back my regular controller and change   auto_actions :all to   auto_actions :none 

It did fix the issue and got me what i wanted . but want to understand whats causing the crash. 

Admin::HospitalsController < ApplicationController #inherits directly from ApplicationController and not HospitalsController


Thanks
Vivek

Vivek Sampara

unread,
Jan 9, 2013, 1:01:36 PM1/9/13
to hobo...@googlegroups.com
Another Update

When the application is running when i change  auto_actions :all to   auto_actions :none it works. but upon application restart , it crashes again 

are we supposed to have  auto_actions :all on regular controller too ?

Vivek 
Reply all
Reply to author
Forward
0 new messages