Beginner issue - databases reference

Hi,

I have teo databases. One is called products, the other categories.
Basically, I have products and they are linked to a category.

Scheme :

products :

name:string
category:references (?)
comments:text

categories :

name:string
place_to_recycle_product:string
comments:text

I don't know how to link the two databases and what command I need to
use to generate the scheme... Could you help me?

Thanks :slight_smile:

Does this actually have anything to do with Rails?

If so, have you gone through any tutorials, particularly ones focused
on Rails/ActiveRecord Associations ?

Because that would be the place to start :slight_smile:

Well... I've read some tutorials and basically, what I had to do was to
create a database with the command scaffold. I had to choose :references
as the type of one of my table entry... But the thing is I can't figure
which entry to reference to...

Sorry, that doesn't make any sense to me.

You might want to step back and document exactly what you're done
so far, and post that and the code for the models you've (I'm guessing)
created via scaffolding.

It would help to know what version of Rails you're using, as well.

Please don't top post, it makes it difficult to follow the thread.
Insert your reply at appropriate points in the previous post. Thanks.

Well... I've read some tutorials and basically, what I had to do was to
create a database with the command scaffold. I had to choose :references
as the type of one of my table entry... But the thing is I can't figure
which entry to reference to...

I think the confusion here is that you have said that you have two
databases. I suspect that you mean two tables in one database. Is
that correct?

I suggest that you have a look at the Rails Guides, starting with
Getting Started, then ActiveRecord Associations, Routing, and
Debugging. I mean a good work through, do not just skim over then.
Then (or in parallel) work through some tutorials. railstutorial.org
is good and free to use online. Make sure that you have Rails 3
installed and any tutorial you use is for that version of rails.

Colin