Backgroup:
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

Problem:
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!
Solution1:
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.

Solution2:
It seem that the document belongs to the author. so i use the nested
resources and add this line in route.rb
map.resources :authors,:has_many=>:documents
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
side.

I really confused about this and hope for your suggestion!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to