Hi --
Hello, I have a question on normalizing: lets say i have three tables table1, table2 and table3 1 has many records in 2 and 2 has many records in 3.
If i normalize it right, i can get records in table3 only through a join with table 2. i can imagine this is not the best solution for speed and simplicity
Could it be smart to include the primary key of table 1 also in table 3, so that there is also a direct connection between the 2 or is this a real bad praktice?
are there developers out there who choose to do so?
Would love to hear your opinions
Most ActiveRecord databases are probably best described as paranormalized It's unlikely to be bad to aim for a fairly high degree of normalization, though; and in some respects ActiveRecord will give you some support. In your example, it sounds like you could use a :through-modified association:
class Table1 has_many :table_3s, :through => :table2
and so forth. The speed should be OK; when you do:
@table1.table3_s
it's all done with one query.
David