Profiles

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

On 22 October 2013 21:27, Orlando H. [email protected]
wrote:

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

Googling for
rails devise user profile
provides many hits that look as if they may answer this question.

Colin

On Tue, Oct 22, 2013 at 4:27 PM, Orlando H.
[email protected] wrote:

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?

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

-Dave


Dave A., the T. Rex of Codosaurus LLC,
secret-cleared freelance software developer
taking contracts in or near NoVa or remote.
See information at http://www.Codosaur.us/.

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

2013/10/26 Dave A. [email protected]

On Sat, Oct 26, 2013 at 2:31 PM, Orlando H.
[email protected] wrote:

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
Ruby…

-Dave


Dave A., the T. Rex of Codosaurus LLC,
secret-cleared freelance software developer
taking contracts in or near NoVa or remote.
See information at http://www.Codosaur.us/.