ruby on rails - How do I model Child belongs to class -


create_table "children", force: :cascade |t|     t.string   "name"     t.date     "dob"     t.string   "child_class"     t.string   "section"     t.integer  "parent_id"     t.datetime "created_at",  null: false     t.datetime "updated_at",  null: false   end 

this schema have child model. child_class values getting stored "1", "2" .. "12".

should need create 12 different models, class1 class12 , have belongs_to child class? there efficient way to this?


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -