Question from a relative newbie. I have the following models (rails -v
Rails 2.3.8)
class Node < ActiveRecord::Base
belongs_to :containable, :polymorphic => true
end
class Root < ActiveRecord::Base
has_one :node, :as => :containable
validates_presence_of :owner
validates_numericality_of
The polymorphic :locatable association implies a :locatable_type and
:locatable_id column. These columns reference a row in an arbitrary table
identified by :locatable_type so no join table is needed.
On Feb 7, 2010 11:02 PM, "Sean Six" wrote:
This is an example from the geokit plugin which I am
This is an example from the geokit plugin which I am trying to
reproduce.
class Location < ActiveRecord::Base
belongs_to :locatable, :polymorphic => true
acts_as_mappable
end
class Company < ActiveRecord::Base
has_one :location, :as => :locatable # also works for belongs_to
associations
3 matches
Mail list logo