My favorites | Sign in
Project Home Downloads Wiki Issues
Search
for
WhatTheGeneratorsDo  
Updated Feb 4, 2010 by timchar...@gmail.com
  • Only if many roles are used:
    • Generates habtm table, creates role.rb with the habtm declaration. Adds declaration in user.rb (scans the code for "class User < ActiveRecord::Base", and puts the new code right after it.
    • Creates an admin user in users.yml, with a role named admin in roles.yml, including a fixture to demonstrate how to relate roles to users in roles_users.yml
  • Modify the user.rb (or corresponding user model) file, add the instance method has_role?
  • Generates RoleRequirementSystem against for the corresponding user model.
  • Generates a migration to make the necessary database changes
  • Scans ApplicationController, inserts the lines "include AuthenticatedSystem", and "include RoleRequirementSystem", if not already included.
  • Scans test_helper.rb and adds "includes RoleRequirementTestHelpers", if not already included.
Comment by s.camb...@gmail.com, Jan 12, 2009

The line 'script/generate authenticated user sessions' doen't work for me (I'm on Windows XP). So I tried 'script/generate authenticated user sessions'. It gave the following error: Couldn't find 'authenticated' generator. So what's wrong here?

Comment by s.camb...@gmail.com, Jan 12, 2009

I have Rails 2.2.2 and this comand doesn't work for me. May by you should write 'ruby script/generate model User (fields if needed)'

Comment by cmfmob...@gmail.com, Jan 17, 2009

@s.cambour... Make sure you download the restful_authentication plugin before running the 'ruby script/generate authenticated user sessions' command. If you have downloaded it, make sure the restful authentication folder in the vendor/plugins directory is called 'restful_authentication' instead of 'restful-authentication'.

Comment by funkj...@gmail.com, Mar 13, 2009

If your using 2.3 you'll need to update line 52 in role_generator_helpers.rb to point to application_controller.rb instead of application.rb for the generator to work.

Comment by s...@sebwills.com, May 17, 2009

@funkjedi: The source seems to have been updated to do this automatically now.

Comment by anexi...@gmail.com, Aug 19, 2009
  • role_generator_helpers.rb is no where to be found in vendor/restful_authentication
  • checked that the restful authentication folder in the vendor/plugins directory is called 'restful_authentication'
  • I am using rails 2.3.3 and this still doesn't work.

When I run "./script/generate authenticated user sessions \ —include-activation \ —stateful \ —rspec \ —skip-migration \ —skip-routes \ —old-passwords ", all I get is Couldn't find 'authenticated' generator


Sign in to add a comment
Powered by Google Project Hosting