On 7 October 2010 17:24, radhames brito <[email protected]> wrote: > > @colin > > Thanks, someone finally cared. > >> 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.
I don't see that as a problem. > >> 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, and what i call user, which is the > company employee in this case, has many roles. You have that already with the different models. You can either continue with separate controllers/views or merge them as seems most appropriate. Remember a controller does not need to map to a model. > >> User belongs_to role, Role has_many users >> and so on. > > im already think of making this a HBTM association, since , but only for the > "user" role/type since is the one with many roles. > > > 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. > > 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. Again that is not necessarily a problem, though it is all a matter of degree of course. If you really think that here you have different types of users rather than users with different roles you could look at STI as an alternative. Colin -- 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.

