Here are my models
class ProductFamily < ActiveRecord::Base
	has_many :product_family_columns, -> {order("ordinal")}, :dependent => :destroy

class ProductFamilyColumn < ActiveRecord::Base
  	belongs_to :product_family
  	has_many :product_family_column_values, :dependent => :destroy

class ProductFamilyColumnValue < ActiveRecord::Base
  	belongs_to :project_family_column
  	belongs_to :unit

class Unit < ActiveRecord::Base
  	belongs_to 	:brand
  	belongs_to 	:product_family
  	has_many 	:product_family_column_values, :dependent => :destroy
I'm having trouble getting my head wrapped around doing dynamic 'tables', storing column names and values in the database. Was hoping someone on here could point me in the right direction, I think my model is setup correctly…*I might need to put matching ordinal values on the ProductFamilyColumnValue table, but beyond that seems like a solid set of models.

So if I get a ProductFamily record, shouldn't I be able to get all Units that belong to that family and includeproduct_family_column_values) to display record column values? In the end, what I would like to be able to do is visit a ProductFamily show page, output associated columns and then output Unit rows and the values that belong to the unit. Showing Units and Column names isn't an issue, getting the column values is where I'm getting hung up.

Any help is appreciated.