Customer has many old documents(just some scanning pictures) and want
to store them into computer,we need to input the doc and relate them
to the existing authors in DB.
Key works: document;author
UI of document input page:
left side is the document input form
right side is the author search form
How should i arrange the code to deal with it.
I have 2 solutions, but i do not like them all! I think maybe i have
some misunderstanding of restful!
let the document handles them all, put the current page under folder
“views/documents”, make the author search form a partial template and
locate it under folder “views/documents” too, put the search_author
method in DocumentsController.this really works,but it break the REST
rules, how could i write the url for search_author method?
I think the search_author method should be write in
AuthorsController.If I do this, i can not get the search result
@authors from AuthorsController.
It seem that the document belongs to the author. so i use the nested
resources and add this line in route.rb
but this require that every operation on document should under a given
author, the “action” attribute of document form should be like this
“authors/2/documents”, but I do not know the author until the client
side user select one from the search result, it happens at client
I really confused about this and hope for your suggestion!