I have a form, submitted form content, some data is inserted into the content table, some are attachments (document), and another table needs to be inserted separately. (Some may be another table ). Document is an association attribute of content (which can be found through content ). This situation... I have a form, the submitted form content, some data is inserted into the content table, some are attachments (document), and another table needs to be inserted separately.
(Some may be another table ). Document is an association attribute of content (which can be found through content ). In this case, I am in the controller.
Use
Content. save (contents)The method will hide the details of the document better?
Or pass
If (has (document) then file. save (documents)
Which method is better?
Reply content:
I have a form, submitted form content, some data is inserted into the content table, some are attachments (document), and another table needs to be inserted separately.
(Some may be another table ). Document is an association attribute of content (which can be found through content ). In this case, I am in the controller.
Use
Content. save (contents)The method will hide the details of the document better?
Or pass
If (has (document) then file. save (documents)
Which method is better?