I recommend keeping the table. Let me explain why and try to explain how to set it up better.
This type of information is known at the outset of the application and it sounds like it is unlikely to change significantly over time. As such it could be pulled into a domain table, similar to states and zipcodes for example. Some benefits: 1) allows you to ensure referential integrity at the database level. This will ensure that your rails app, the pgsql or mysql prompt, another app, etc can only enter valid user roles. 2) changes can be made in one central location in the database 3) more importantly it scales the app may require additional information. For example, if you ever want to add more data associated with a role you can do this in an appropriate table. Take an address model and zipcode field as an example. Since zipcodes are known at the outset of an application they can be pulled into a domain table that the address table references. Then if you add latitude and longitude info to do distace calculations, you have a place to put this information and not repeat it many times within the address table. The same may be true for your user roles as the app evolves. Drawbacks this is a bit more work upfront but I argue that it is well worth it in the long run. Setting up a solid data layer is the most important part of any application. The data will likely outlive the app built atop it. Best to use solid db techniques. Make a migration for your user roles and a AR::base model. Make your constants there. For example in UserRole < AR::Base define ADMIN = 1, etc. Then in the code for a user set @user.user_role_id = UserRoles::ADMIN. You can also write a function to create and cache these automatically based on the name you provide. I will leave that part to you. Just my thoughts Andrew
-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

