The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Your table names should be product_lines and products, lowercase with underscores, not camel case. That is the Rails convention. If you really want to keep it as it is, then you need to set the table name in each of your models. E.g.

Code:

class ProductLine < AR::Base
set_table_name 'ProductLines'
end

I'd recommend sticking with Rails conventions unless you are forced to do otherwise (for example, working with legacy databases).

To add to this, I've been playing with rails a bit lately and don't really get how to do relationship mapping with active record. I can't seem to find a decent tutorial that I can wrap my head around it. Maybe im just tring to hard.

Anyone have a good page or tutorial or something available that points out how to handle relationships? I'd be really greatful

Thanks,
Eric

Eric Coleman
We're consentratin' on fallin' apart
We were contenders, now throwin' the fight
I just wanna believe, I just wanna believe in us

Luke: product_line is the same thing as a category. It is a way to group products. How would you have named the table/field/model differently?

If your current product_line column in your products table references an ID in the product_lines table, then according to the Rails conventions it should be called product_line_id. That way you don't get confusion like the above

I'm limited, I always seem to stumble back to the same two words when I'm naming fields. "name" and "description". In fact I'm about a few days from starting a thread asking for advice on better names. Who knows, maybe "name" and "description" are fine. They are probably less ambiguous in templates than what you have.

Code:

<% for product in products %>
<%= product.name %>
<%= product.description %>
<%= product.product_line.name %>
<%= product.product_line.description %>
and don't forget that you can...
<%= debug product %>
<%= debug product.methods %>
<%= debug product.product_line %>
<%= debug product.product_line.methods %>
... to get an idea of what data and methods
are available to you with an object.
<% end %>

Using your unpaid time to add free content to SitePoint Pty Ltd's portfolio?