Radhames Brito wrote:
> from my fourth comment
> 
> I presume that your models are Admin, Owner, User and Client (or
>>> similar names).
>>>
>>
> 
>> yes exactly, but i created separated models because there would be a lot of
>> conditional validations if i didnt,
>> for example owners can manage a companies but a user should belong to a
>> company.
> 
> 
> 
>>
>> The fact that you worded your initial requirement as
>>> I have pointed out above suggests that these are all Users with
>>> different roles.
>>>
>>
> yes but i would require different controllers and views for each 
> roles/type
>> of user,

That doesn't mean you need different models to go along with them.

> and what i call user, which is the
>> company employee in this case, has many roles.

HABTM roles is perfectly feasible.  You might want to use something like 
rails_authorization or CanCan to make managing privileges easier.

>>
> 
> 
> 
> I though about all this before, but the reason i have hesitated to do it
>> this way is because of the validations, excess in attributes
>> for the roles/types that dont require them and possible security issues.

Huh?  No.  A User is a User is a User, if I understand correctly.  Stop 
trying to justify a bad design decision.

>>
>> I see not way of avoiding the creation of a very fat user model, with lots
>> of accesible attributes dynamically changing and lots of scopes.

There's nothing wrong with a fat model if it is the best representation 
for your data.  But I'd be more inclined to use various has_ones for the 
additional information.

I'm doing something like this in a medical records app I'm working on, 
where clinicians and patients are both Users, but each patient record 
also has_one Chart to hold medical information that clinicians don't 
have stored.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
-- 
Posted via http://www.ruby-forum.com/.

-- 
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.

Reply via email to