Hi is I’m making a web app in which I am asked to register users, I did this already with Devise the problem is that I also create a profile for each user to register … anyone have idea how to do? if so thank you very much hope you can help me
Hi is I'm making a web app in which I am asked to register users, I did this
already with Devise the problem is that I also create a profile for each
user to register ... anyone have idea how to do? if so thank you very much
hope you can help me
rails devise user profile
provides many hits that look as if they may answer this question.
There are two main ways to do this.
One very common way is to just tack more fields onto your User model.
This isn't very good, though, as your User model then fulfills
different duties: holding the credentials for logging in (the main
duty), holding whatever other profile-type info you want to store,
etc. Having the objects of one class fulfill a bunch of different
duties violates what Object Oriented people call the "Single
Responsibility Principle" (SRP), and makes it a "God Object" (very
powerful, yes, but usually so big, and with so much tight coupling
between the different duties, that it's very hard to maintain).
Much "cleaner" is to create another model, called something like
Profile, and have either Profile belong to User or vice-versa or both.
(Which way you do it may depend on things like whether you want one
User to be able to have multiple Profiles, or let multiple Users share
a Profile, or maybe even both. Assuming you want "one User, one
Profile", it probably won't matter much.)
Hello thank you very much and seriously almost solved the problem and was not as complicated as I imagined thank you both for responding and it really is nice to have a community that is willing to help
was not as complicated as I imagined
It's amazing how many problems are that way!
it really is nice to have a community that is willing to help
Yup, that's one of the things I love about Ruby. For whatever reason,
the Ruby community has become much more open, welcoming, willing to
bend over backwards to help, etc. than any other technical community I
have ever seen. They were very patient with me at my first RubyDCamp,
which I went to two weeks after learning my first little bit of