ruby on rails - How do I insert into different tables from one controller? -


i'm developing application create fishbone diagram.

i created several models handle different levels of causes , effects. thing is, application have 1 form introduce data different levels, how can it?

can have 1 controller insert info different tables?

some simple inheritance trick if going treating them different logic.

have base model

class bone < activerecord::base  end 

then 3 inherit it.

class backbone < person  end  class ribbone < person  end  class outsidebone < person  end 

then can handle 3 of classes in person controller using person base. each have own logic if needed.

if need can ownership on itself, might helpful in case.

class bone < activerecord::base     has_many :bones     belongs_to :master_bone, :class_name => "bone", :foreign_key => "bone_id" end  

Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -