I am playing around with acts_as_authenticated as many recommend it
for authentication. I have two relevant model: Worker and Company.
Registration for both Workers and Companies should be pretty similar:
username, email, password, email verification, etc.
I thought of two possible solutions, both of which may be ood/bad
ideas: I don’t know because I am too new to rails at this point
(1) Create a UserBase class that is the model created by the
acts_as_authenticated generator. From there, I can use polymorphism
and STI to derive Workers and Companies, each with their own unique
properties, but sharing the common authentication stuff.
(2) Trying to generate seperate models using the acts_as_auth
I really would appreciate some guidance here. Obviously, Workers and
Companies should only be allowed to access the resources of the site
permissible to each. However, using before_filter :login_required
doesn’t seem to be able to specify which model requires
Maybe acts_as_auth isn’t the best solution, but I have no idea. Maybe
I should roll my own based on the example code from “Rails Recipes”,
as I need both authentication and resource authorization; I just
didn’t want to reinvent the wheel.
Thanks for any suggestions.