Reputation: 290
I am new to rails and having a hard time figuring out what is the best association I can create for my models. The models I have are:
Here, User can create many Articles
and Lists
, an Article
and List
can belong to multiple Lists
, an Article
can have multiple ArticleLinks
and ArticleMeta
. I also want to delete all the references of a model wrt User
when it is deleted. For example when an User
deletes a List
, all the reference of the List
should be deleted from join tables.
Also please let me know what would be the most efficient way to insert records in each model and retrive records as well
Thank you for your help.
Upvotes: 0
Views: 27
Reputation: 130
You can find all your answers over this link http://guides.rubyonrails.org/command_line.html
As example
rails generate scaffold Articles name:string category:string lists:references
or
rails generate scaffold ArticleLinks name:string Article:references
Upvotes: 1