Polymorphisme and single table inheritance

Hi

I use STI and polymorphisme as following :

class Franchise < Company

has_one :notebook, :as => :notebookable, :dependent => :destroy

def after_create

self.create_notebook
end

class Notebook < ActiveRecord::Base
belongs_to :notebookable, :polymorphic => true

end

BUT the created notebook record has :notebookable_type = ‘Company’,
whicj is not right, should be ‘Franchise’…

is it correct or should I add another parameter somewhere ?

thanks for your advices…

erwin

end

class Notebook < ActiveRecord::Base
belongs_to :notebookable, :polymorphic => true

end

BUT the created notebook record has :notebookable_type = ‘Company’,
whicj is not right, should be ‘Franchise’…

is it correct or should I add another parameter somewhere ?

Did you ever get an answer to this? I am faced with a similar problem.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs