Hey everyone.. I''m trying to create a site where each user can have multiple profiles. My base user table has simple imformation like first name, last name, email, username, password, etc. Now I want to associate one or more profiles to each user. I created the Profile table (very simple right now) and added the following to my User and Profile models: class User < ActiveRecord::Base has_many :profiles end class Profile < ActiveRecord::Base belongs_to :user end And in my Profiles table I added the following new column: user_id I didn''t add anything new to the Users table (am I supposed to?) I am using the Salted_login_generator, so I would like a new profile to be created for a user when they sign up and successfully create an account. I''m just not sure how to go about creating a new profile object, assigning it to the user object and having it all save in to the database. Any help would be greatly appreciated!
Ramin <i8ramin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:> class Profile < ActiveRecord::Base > belongs_to :user > endkeep in mind ''profile'' is a reserved word... You''ll want to think of something else to call it. I know, ''profile'' is the exact word you want to use. It made me sad for a while too. -- Doug Alcorn - http://lathi.net/RubyOnRailsDeveloper doug-jGAhs73c5XxeoWH0uzbU5w@public.gmane.org
Is ''profile'' really a reserved word? That''s crazy.. I can''t think of anything else to name my model. My users must have multiple "profiles" .... what else can I call them? any suggestions... :-P On 9/12/05, Doug Alcorn <doug-jGAhs73c5XxeoWH0uzbU5w@public.gmane.org> wrote:> Ramin <i8ramin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes: > > > class Profile < ActiveRecord::Base > > belongs_to :user > > end > > keep in mind ''profile'' is a reserved word... You''ll want to think of > something else to call it. I know, ''profile'' is the exact word you > want to use. It made me sad for a while too. > -- > Doug Alcorn - http://lathi.net/RubyOnRailsDeveloper > doug-jGAhs73c5XxeoWH0uzbU5w@public.gmane.org > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- - Ramin http://www.getintothis.com/blog
well, it depends on how you are using profile...if you are using it to handle user grouping types, say like, guest/user/admin, then how about ''role(s)''? otherwise, try http://thesaurus.reference.com/search?q=profile On 9/12/05, Ramin <i8ramin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Is ''profile'' really a reserved word? That''s crazy.. I can''t think of > anything else to name my model. My users must have multiple "profiles" > .... what else can I call them? any suggestions... :-P > > > On 9/12/05, Doug Alcorn <doug-jGAhs73c5XxeoWH0uzbU5w@public.gmane.org> wrote: > > Ramin <i8ramin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes: > > > > > class Profile < ActiveRecord::Base > > > belongs_to :user > > > end > > > > keep in mind ''profile'' is a reserved word... You''ll want to think of > > something else to call it. I know, ''profile'' is the exact word you > > want to use. It made me sad for a while too. > > -- > > Doug Alcorn - http://lathi.net/RubyOnRailsDeveloper > > doug-jGAhs73c5XxeoWH0uzbU5w@public.gmane.org > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > -- > - Ramin > http://www.getintothis.com/blog > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Ezra Zygmuntowicz
2005-Sep-12 23:34 UTC
Re: User has_many profiles, Profile belongs_to User
How about bio or character? -Ezra On Sep 12, 2005, at 2:52 PM, Ramin wrote:> Is ''profile'' really a reserved word? That''s crazy.. I can''t think of > anything else to name my model. My users must have multiple "profiles" > .... what else can I call them? any suggestions... :-P > > > On 9/12/05, Doug Alcorn <doug-jGAhs73c5XxeoWH0uzbU5w@public.gmane.org> wrote: > >> Ramin <i8ramin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes: >> >> >>> class Profile < ActiveRecord::Base >>> belongs_to :user >>> end >>> >> >> keep in mind ''profile'' is a reserved word... You''ll want to think of >> something else to call it. I know, ''profile'' is the exact word you >> want to use. It made me sad for a while too. >> -- >> Doug Alcorn - http://lathi.net/RubyOnRailsDeveloper >> doug-jGAhs73c5XxeoWH0uzbU5w@public.gmane.org >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> >> > > > -- > - Ramin > http://www.getintothis.com/blog > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-Ezra Zygmuntowicz Yakima Herald-Republic WebMaster 509-577-7732 ezra-gdxLOakOTQ9oetBuM9ipNAC/G2K4zDHf@public.gmane.org
alter_egos? ;) On 9/13/05, Ezra Zygmuntowicz <ezra-gdxLOakOTQ9oetBuM9ipNAC/G2K4zDHf@public.gmane.org> wrote:> > How about bio or character? > > -Ezra > > On Sep 12, 2005, at 2:52 PM, Ramin wrote: > > > Is ''profile'' really a reserved word? That''s crazy.. I can''t think of > > anything else to name my model. My users must have multiple "profiles" > > .... what else can I call them? any suggestions... :-P > > > > > > On 9/12/05, Doug Alcorn <doug-jGAhs73c5XxeoWH0uzbU5w@public.gmane.org> wrote: > > > >> Ramin <i8ramin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes: > >> > >> > >>> class Profile < ActiveRecord::Base > >>> belongs_to :user > >>> end > >>> > >> > >> keep in mind ''profile'' is a reserved word... You''ll want to think of > >> something else to call it. I know, ''profile'' is the exact word you > >> want to use. It made me sad for a while too. > >> -- > >> Doug Alcorn - http://lathi.net/RubyOnRailsDeveloper > >> doug-jGAhs73c5XxeoWH0uzbU5w@public.gmane.org > >> _______________________________________________ > >> Rails mailing list > >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > >> http://lists.rubyonrails.org/mailman/listinfo/rails > >> > >> > > > > > > -- > > - Ramin > > http://www.getintothis.com/blog > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > -Ezra Zygmuntowicz > Yakima Herald-Republic > WebMaster > 509-577-7732 > ezra-gdxLOakOTQ9oetBuM9ipNAC/G2K4zDHf@public.gmane.org > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
These are all really great suggestions... but i just cant believe I can''t use the word profile. Its just so counter intuitive to use anything else to describe something that is usually described by the word Profile. Its sort of like replacing the term Cancel with Abort. They can both be used, but Cancel is so much better and people recognize it. Hmmm... I guess I can settle for something else... is there a way to list all reserved words in Ruby? I wanna make sure im not using any others.... Besides the naming issue ... where can I find information about associating a bunch of "profiles" to a user. I need to know how to setup my database and also my models. I have the Agile Dev. with Rails book, any chapter(s) I should be concentrating on? Thanks for the help. On 9/12/05, Bogdan Ionescu <bogdan.ionescu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> alter_egos? ;) > > > On 9/13/05, Ezra Zygmuntowicz <ezra-gdxLOakOTQ9oetBuM9ipNAC/G2K4zDHf@public.gmane.org> wrote: > > > > How about bio or character? > > > > -Ezra > > > > On Sep 12, 2005, at 2:52 PM, Ramin wrote: > > > > > Is ''profile'' really a reserved word? That''s crazy.. I can''t think of > > > anything else to name my model. My users must have multiple "profiles" > > > .... what else can I call them? any suggestions... :-P > > > > > > > > > On 9/12/05, Doug Alcorn <doug-jGAhs73c5XxeoWH0uzbU5w@public.gmane.org> wrote: > > > > > >> Ramin < i8ramin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes: > > >> > > >> > > >>> class Profile < ActiveRecord::Base > > >>> belongs_to :user > > >>> end > > >>> > > >> > > >> keep in mind ''profile'' is a reserved word... You''ll want to think of > > >> something else to call it. I know, ''profile'' is the exact word you > > >> want to use. It made me sad for a while too. > > >> -- > > >> Doug Alcorn - http://lathi.net/RubyOnRailsDeveloper > > >> doug-jGAhs73c5XxeoWH0uzbU5w@public.gmane.org > > >> _______________________________________________ > > >> Rails mailing list > > >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > >> http://lists.rubyonrails.org/mailman/listinfo/rails > > >> > > >> > > > > > > > > > -- > > > - Ramin > > > http://www.getintothis.com/blog > > > _______________________________________________ > > > Rails mailing list > > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > -Ezra Zygmuntowicz > > Yakima Herald-Republic > > WebMaster > > 509-577-7732 > > ezra-gdxLOakOTQ9oetBuM9ipNAC/G2K4zDHf@public.gmane.org > > > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >-- - Ramin http://www.getintothis.com/blog
I also noticed that Profile does not appear in this list of reserved words, http://wiki.rubyonrails.com/rails/show/ReservedWords are you sure it is a reserved word? On 9/12/05, Ramin <i8ramin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> These are all really great suggestions... but i just cant believe I > can''t use the word profile. Its just so counter intuitive to use > anything else to describe something that is usually described by the > word Profile. Its sort of like replacing the term Cancel with Abort. > They can both be used, but Cancel is so much better and people > recognize it. > > Hmmm... I guess I can settle for something else... is there a way to > list all reserved words in Ruby? I wanna make sure im not using any > others.... > > Besides the naming issue ... where can I find information about > associating a bunch of "profiles" to a user. I need to know how to > setup my database and also my models. I have the Agile Dev. with Rails > book, any chapter(s) I should be concentrating on? > > Thanks for the help. > > On 9/12/05, Bogdan Ionescu <bogdan.ionescu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > alter_egos? ;) > > > > > > On 9/13/05, Ezra Zygmuntowicz <ezra-gdxLOakOTQ9oetBuM9ipNAC/G2K4zDHf@public.gmane.org> wrote: > > > > > > How about bio or character? > > > > > > -Ezra > > > > > > On Sep 12, 2005, at 2:52 PM, Ramin wrote: > > > > > > > Is ''profile'' really a reserved word? That''s crazy.. I can''t think of > > > > anything else to name my model. My users must have multiple "profiles" > > > > .... what else can I call them? any suggestions... :-P > > > > > > > > > > > > On 9/12/05, Doug Alcorn <doug-jGAhs73c5XxeoWH0uzbU5w@public.gmane.org> wrote: > > > > > > > >> Ramin < i8ramin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes: > > > >> > > > >> > > > >>> class Profile < ActiveRecord::Base > > > >>> belongs_to :user > > > >>> end > > > >>> > > > >> > > > >> keep in mind ''profile'' is a reserved word... You''ll want to think of > > > >> something else to call it. I know, ''profile'' is the exact word you > > > >> want to use. It made me sad for a while too. > > > >> -- > > > >> Doug Alcorn - http://lathi.net/RubyOnRailsDeveloper > > > >> doug-jGAhs73c5XxeoWH0uzbU5w@public.gmane.org > > > >> _______________________________________________ > > > >> Rails mailing list > > > >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > > >> http://lists.rubyonrails.org/mailman/listinfo/rails > > > >> > > > >> > > > > > > > > > > > > -- > > > > - Ramin > > > > http://www.getintothis.com/blog > > > > _______________________________________________ > > > > Rails mailing list > > > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > > -Ezra Zygmuntowicz > > > Yakima Herald-Republic > > > WebMaster > > > 509-577-7732 > > > ezra-gdxLOakOTQ9oetBuM9ipNAC/G2K4zDHf@public.gmane.org > > > > > > _______________________________________________ > > > Rails mailing list > > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > -- > - Ramin > http://www.getintothis.com/blog >-- - Ramin http://www.getintothis.com/blog
Ramin wrote:>I also noticed that Profile does not appear in this list of reserved words, >http://wiki.rubyonrails.com/rails/show/ReservedWords > >are you sure it is a reserved word? > >Good question. Does the Ruby profile.rb interfere with a model named profile.rb? require ''profile'' would obviously cause some confusion. -Robby
Well, I ended up naming my model UserProfile .. so hopefully that wont interfere with anything... now, I just gotta figure out how to assign these UserProfiles to my User during signup.... hmmm.. baby steps, baby steps ... On 9/13/05, Robby Russell <robby.lists-/Lcn8Y7Ot69QmPsQ1CNsNQ@public.gmane.org> wrote:> Ramin wrote: > > >I also noticed that Profile does not appear in this list of reserved words, > >http://wiki.rubyonrails.com/rails/show/ReservedWords > > > >are you sure it is a reserved word? > > > > > > Good question. Does the Ruby profile.rb interfere with a model named > profile.rb? > > require ''profile'' would obviously cause some confusion. > > > -Robby >-- - Ramin http://www.getintothis.com/blog