Is there an easier way to set up and admin controller in rails other than
http://www.akitaonrails.com/2007/12/12/rolling-with-rails-2-0-the-first-full-tutorial
?
This seems like way too much work. Please help if you can. Your help is greatly appreciated.
Thank you very much.
Kamau Osaze
I' am just working on a hotel booking application and I decided to give the administrator
own controllers and views. For me it's easier to maintain.
If I use the same template for guests and admins I have a lot of
<% if !admin? %>
guest things to show
<% else %>
admin things to show
<% end &>
...
so I decided to make it this way:
app
controllers
admin
bookings_controller.rb
guests_controller.rb
...
bookings_controller.rb
guest_controller.rb
...
views
admin
bookings
index.html.erb
guests
index.html.erb
...
bookings
index.html.erb
guests
index.html.erb
I have a lot of files but for me it's easier to maintain 2 templates - allowing me to generate
2 completly different outputs without having lots of if - conditions.
This thread has links to other articles besides Akita's:
http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/f6c1b3a546e7e240?hl=en
In particular, using a single controller with conditional logic is
discussed in one article.
///ark