I have multiple sections of my site that need to be accessed through an admin section. I was able to get them to work by using admin/subfolder, but I would like to make a "dashboard" sort of page when going to just domain.com/admin. I'd like it to include a login form and once logged in show a list of all the controllers in the admin/ directory. I've searched through many different SVNs from RailsDay and have seen many sites that have their admin controllers in an admin/ folder, but none seem to have a default admin page that has links to each one. Can someone please give me some help or point me in the right direction?
on 2006-10-07 20:54
on 2006-10-07 21:06
On Oct 7, 2006, at 2:54 PM, John Saunders wrote: > many sites that have their admin controllers in an admin/ folder, but > none seem to have a default admin page that has links to each one. > > Can someone please give me some help or point me in the right > direction? You could set up an admin/welcome or admin/dashboard controller and then map to that with a custom route such as: map.dashboard 'admin', :controller => 'admin/dashboard' James.
on 2006-10-07 22:08
James Stewart wrote: >> > > map.dashboard 'admin', :controller => 'admin/dashboard' > > James. > > > > > I've done done my controllers in a RESTful way (with admin only access to the new/edit/create/update/destroy actions) and then had an admin controller whose index action is just what you're describing -- a dashboard type thing showing latest activity and giving various admin options (which link to the RESTful controllers). HTH CT
on 2006-10-07 22:39
James Stewart wrote: > On Oct 7, 2006, at 2:54 PM, John Saunders wrote: >> many sites that have their admin controllers in an admin/ folder, but >> none seem to have a default admin page that has links to each one. >> >> Can someone please give me some help or point me in the right >> direction? > > You could set up an admin/welcome or admin/dashboard controller and > then map to that with a custom route such as: > > map.dashboard 'admin', :controller => 'admin/dashboard' > > James. THANKS! I got it working. Can you or someone please point me into the direction or give me some tips on how to make it so a form will come up anytime someone goes to a page such as admin/ or admin/subfolder like so? Login: textbox Password: textbox Submit
on 2006-10-07 23:16
On Oct 7, 2006, at 4:39 PM, John Saunders wrote: >> then map to that with a custom route such as: > page such as admin/ or admin/subfolder like so? You'll want to make use of a before_filter in your controllers (or in a class that your controllers all inherit from): http://api.rubyonrails.org/classes/ActionController/Filters/ ClassMethods.html#M000152 You might also want to look into one of the authentication plugins, such as acts_as_authenticated and see how that is used: http://technoweenie.stikipad.com/plugins/show/Acts+as+Authenticated James. -- James Stewart http://jystewart.net/process/
on 2006-10-07 23:27
Thanks, I ran the three commands for Acts as Authenticated then put before_filter :login_required at the top of my controllers in the admin/ folder but I'm getting "undefined method `login_required' for #<Admin::ScheduleController:0x282a5d0>". I read through the site you linked me to but I don't see anything that I missed. What do I need to do to define login_required?
on 2006-10-08 01:09
John Saunders wrote: > Thanks, I ran the three commands for Acts as Authenticated then put > before_filter :login_required at the top of my controllers in the admin/ > folder but I'm getting "undefined method `login_required' for > #<Admin::ScheduleController:0x282a5d0>". I read through the site you > linked me to but I don't see anything that I missed. What do I need to > do to define login_required? > > -- > Posted via http://www.ruby-forum.com/. Hi John, in your new account controller you should see this at the top: # Be sure to include AuthenticationSystem in Application Controller instead include AuthenticatedSystem If you haven't done this already then just comment out "include AuthenticatedSystem" in your account controller and add it to your application controller.
on 2006-10-08 04:25
Thanks, I got the form to appear, but where how do I set up the login/password. When I click the login button it comes up with: Mysql::Error: Table 'gd_development.users' doesn't exist: SHOW FIELDS FROM users I looked through many of the links on http://technoweenie.stikipad.com/plugins/show/Acts+as+Authenticated but couldn't find anything about how to set up the users table??
on 2006-10-08 05:15
On 10/7/06, John Saunders <rails-mailing-list@andreas-s.net> wrote: > > Thanks, I got the form to appear, but where how do I set up the > login/password. When I click the login button it comes up with: > > Mysql::Error: Table 'gd_development.users' doesn't exist: SHOW FIELDS > FROM users > > I looked through many of the links on > http://technoweenie.stikipad.com/plugins/show/Acts+as+Authenticated but > couldn't find anything about how to set up the users table?? rake db:migrate
on 2006-10-08 05:19
On Oct 7, 2006, at 10:25 PM, John Saunders wrote: > Thanks, I got the form to appear, but where how do I set up the > login/password. When I click the login button it comes up with: > > Mysql::Error: Table 'gd_development.users' doesn't exist: SHOW FIELDS > FROM users > > I looked through many of the links on > http://technoweenie.stikipad.com/plugins/show/Acts+as+Authenticated > but > couldn't find anything about how to set up the users table?? From: http://technoweenie.stikipad.com/plugins/show/User+Authentication "The way the plugin works is simple. The first thing you do is create the models and migration: script/generate authenticated user account (In older versions of the plugin, you needed to create the migration separately: script/generate authenticated_migration This should no longer be necessary.) This will not only create your User model, but an Account controller, some unit and functional1 tests, and some libraries in lib/. Once thatâ??s done, you can move the include AuthenticatedSystem from app/ controllers/account_controller.rb to app/controllers/application.rb. This makes all the authentication methods available to all controllers." so if you've run the generator to create your models, there should also now be migrations in db/migrate to create the required tables. James. -- James Stewart : Web Developer Work : http://jystewart.net Play : http://james.anthropiccollective.org
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.