Forum: Ruby on Rails Profiles

C4b2cb6c227b8d8f5955d053ed789227?d=identicon&s=25 Orlando Hernandez (Guest)
on 2013-10-23 08:15
(Received via mailing list)
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
5f94b9b346c2aa648a80bc259978e5bc?d=identicon&s=25 Colin Law (Guest)
on 2013-10-23 10:10
(Received via mailing list)
On 22 October 2013 21:27, Orlando Hernandez <ohernandez@unitecnica.net>
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
Ec2c1a36301b0223c3e281bd2ec3f37a?d=identicon&s=25 Dave Aronson (Guest)
on 2013-10-26 20:23
(Received via mailing list)
On Tue, Oct 22, 2013 at 4:27 PM, Orlando Hernandez
<ohernandez@unitecnica.net> 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 Aronson, 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/.
C4b2cb6c227b8d8f5955d053ed789227?d=identicon&s=25 Orlando Hernandez (Guest)
on 2013-10-26 20:33
(Received via mailing list)
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 Aronson <googlegroups2dave@davearonson.com>
Ec2c1a36301b0223c3e281bd2ec3f37a?d=identicon&s=25 Dave Aronson (Guest)
on 2013-10-26 21:49
(Received via mailing list)
On Sat, Oct 26, 2013 at 2:31 PM, Orlando Hernandez
<ohernandez@unitecnica.net> 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 Aronson, 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/.
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.