Hi all,

I have 37 different tables with each having its own sort column (sort
implying that the main data of that table is sorted on that particular
column).  Each of these sort columns is different and unique.

To make things easier for myself I created an inheritance template where
each of the 37 tables inherits from one templated controller and one
templated model.  They all use the same methods.  So all 37
controllers/models are basically empty and the inherited/templated
controller and model contain the objects/methods.

I'm now creating a master table that needs to pull the data from each of
those 37 tables and the sort columns, perform calculations, and then
save the refined calculations back to itself (the master table).

I'm trying to figure out a proper way to setup the associations.  All
I'm doing is gathering data from those tables to calculate further
values.  My master data table belongs to my team model and the rest of
the data tables belong to my team model.  The current associations are:

class Team < ActiveRecord::Base
  has_many    :master_tables
  has_many    :inheritance_templates
end


class MasterTable < ActiveRecord::Base
  belongs_to  :team
end

class InheritanceTemplate < ActiveRecord::Base
  self.abstract_class = true
  belongs_to  :team
end

class DataOne < InheritanceTemplate
end
class DataTwo < InheritanceTemplate
end
class DataThree < InheritanceTemplate
end

I'm not sure how the association should be setup between the Master
Table model and the Inheritance Template model.  They both belong to
team.

Assume that I want to retrieve the following:

DataOne.colomnonedata
DataTwo.columntwodata
DataThree.columnthreedata

I could do:

@one = DataOne.find(:all)
@two = DataTwo.find(:all)
@three = DataThree.find(:all)

and point to a custom method that searches for the specific column and
only returns results for that column but I figured there might be a
better approach to all of this.

Any help would be appreciative..
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to