⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Is able to create alias in grocery crud?



juzepe

juzepe
  • profile picture
  • Member

Posted 08 July 2016 - 12:03 PM

I already have tables with some data and I'm trying establish crud of them. But in my tables columns' names don't match each other. For example I have table `questions` with columns `id` and `content` and table `answers` with columns  `id`, `question_id`, and `content`.

 

How can I set relation between this tables without changing columns' names? Thank for advance. 


Amit Shah

Amit Shah
  • profile picture
  • Member

Posted 12 July 2016 - 08:37 AM

Well my friend,

 

think you need to redesign the same. If - only if your question have or may have multiple answers then there can be 3rd table with  which is a link for question / answers relation. The same can have question_id, answer_id (with multiple answers)

now instead of you setting a set_relation

u can use set_relation_n_n .. and get your issue resolved.

 

Happy GCing :)