Hi.
I have difficulties to model active record.
So please help my trouble.
Let's suppose there are nations which have castles at least 1,
and there are 3 types of castles.
So I will make these tables.
NationsTable,
CastlesTable have common attributes of 3 types of castle.
CastlesATable, CastlesBTable, CastlesCTable each have its unique
attributes.
In this case how can I represent this DB to AR?
I think
class Nation < ActiveRecord::Base
has_many :castles
end
class Castle < ActiveRecord::Base
belongs_to :Nations
end
but I'm not sure of what will be coded to these models.
class CastleA < ActiveRecord::Base
end
class CastleB < ActiveRecord::Base
end
class CastleB < ActiveRecord::Base
end
please help me.
and second question is
when nation deleted, CastleA, CastleB have to be deleted but not for
the castleC type.
how can I do?
thanks for reading.
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---