Frederick Cheung | 8 Jul 20:17
Gravatar

Re: How do you store values for each specific user?


On Jul 8, 6:37 pm, WalkerW <liberata...@...> wrote:
> Just learning Rails trying to get a handle on something in a very
> basic sense:
>
> I can create a login tool, I can create a funciton that creates a
> table based on skills but I have no idea how to make skills local to
> each user?  I was every used to have a list of skills that when they
> login are displayed.. Each user can't have his own database table can
> he?  What is the general way of handling this.

My answer is going to be a bit vague, since your question is a bit
vague. If you skills table has a user_id column then a user's skills
are simply those with the appropriate user_id. Rails' associations
will do most of this for you

class Skill
  belongs_to :user
end

class User
  has_many :skills
end

some_user.skills => The skills for that user

Fred
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@...
To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe <at> googlegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---


Gmane