You should read this tutorial about Relationship
It's really easy to declare associations in Rails.
In your app/models/user.rb
, you could do something like that:
has_one :user_profile
Your user's profile is a different object with its own table. Just make sure that you had the foreign key user_id in it, and you're good to go (also, you should specify belongs_to :user
in your user's profile model).
Now, using Devise, if you want to make sure that a profile is being created after a user registers, you could do something like that (still in your user's model):
after_create :create_child
# Creating child Elements
def create_child
UserProfile.create("user_id" => id)
end
And then, if you want to 'link' a specific URL to a controller, see the routing tutorial
Hope it helps.