Answer the question
In order to leave comments, you need to log in
Rails application architecture?
Given: Rails 3.1, Devise, Mongoid
Need: somehow organize two types of users - Client and Developer, both should have different parameters in the profile. But everyone should be able to login through one form.
There are several ideas, for example - the Client and the Developer are different models, but each embed (embeds) User model.
Or the Client and the Developer are inherited from the User.
Question on StackOverflow
Answer the question
In order to leave comments, you need to log in
Imagine that the project grows and it will be necessary for the user to be both a customer and a performer (for example, a webmaster developer orders a design from a designer contractor). You will need a bike to synchronize the two models.
Take one user model, roles from cancan, here is a tutorial, there are plenty of attributes so that there are enough custom validators for all roles - what type of user can have which attributes. The form from devise will automatically turn out one.
Although one form can be drawn through partial, put the required object in : locales, if there are fields that are used in the form, everything will work out.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question