Hi,

I have a question about single table inheritance and controllers. Lets
start to talk about my domain. There are two parent models in my
system, they and their children are;
                 class Vehicle < ActiveRecord::Base
 
attr_accessible :name, :model, :engine, :fuel_type .....
                          validates ....................
                          has_many :tires
                 end

                class  Car < Vehicle
                          attr_accessible :car_type, :speed .....
                          validates ....................
                 end
                 class  Truck < Vehicle
 
attr_accessible :load_volume, :number_of_tires .....
                          validates ....................
                 end

                 class Tire < ActiveRecord::Base
                          attr_accessible :diameter, :material ......
                          validates ....................
                         belongs_to : vehicle
                 end

                class  WinterTire < Tire
                          attr_accessible :winter_tire_type....
                          validates ....................
                 end
                 class  SummerTire < Tire
                          attr_accessible :summer_tire_type....
                          validates ....................
                 end

To create restful controllers for these classes I choose generating
parent controllers so;
                class Vehicles < ApplicationController
                         methods
                end
                class Tires < ApplicationController
                         methods
                end

But I end up with a confusion how to use same controllers for creating
different type of child objects. Is my choice feasible or creating
seperate controllers is more suitable? But doesn't that mean a
conflict with DRY style?
Thank you...
Rushen

-- 
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