Admin interface in Rails
Posted
by yuval
on Stack Overflow
See other posts from Stack Overflow
or by yuval
Published on 2010-03-15T06:23:43Z
Indexed on
2010/03/15
6:29 UTC
Read the original article
Hit count: 411
I have an admin controller located in controllers/admin/admin_controller.rb
I also have a pages controller located in controllers/admin/pages_controller.rb
pages_controller.rb
inherits from admin_controller.rb
in routes.rb, I have an admin namespace as such:
map.namespace :admin do |admin|
admin.resources :pages
end
- I want the admin have basic CRUD functionality in
pages_controller.rb
(I know how to do that) - I want the
index
andshow
methods to be available to front-end users - I would like the show and index actions to use separate views, but the same code.
Questions:
- Should I create a new
pages_controller
for the front-end, or share the methodsindex
andshow
? - If share, how would I display separate views depending on whether the url is
/admin/pages
or/pages
- If share, should I place
pages_controller
in/controllers/admin
(where it is now) or just in/controllers
?
Thank you very much.
© Stack Overflow or respective owner