I would give a try at this:
For resources in routes.rb:
  map.resources :authors
  map.resources :documents
  map.resources :authors, :has_many => :documents

So, documents should be accessible by themselves or as sub-resources
of authors.

For controllers, both authors and documents should return an index of
all of them because you want to pair them up.
Or, try using :collection in routes.rb to GET only :unassigned
documents (thinking aloud here).

Finally, for your Documents view, use Ajax to make a RESTful call to
all available Authors and populate a listbox.
And when you Submit the form with paired-up Authors and Documents,
make it an Ajax POST to authors/auth_id/documents with param doc_id.
You'll have to manage also updates and deletes.

This was just a plan, I'd like to know if it can work this way.

Cheers!


On Dec 6, 7:42 am, 乱翻字典 <[EMAIL PROTECTED]> wrote:
> As you know, the document create page contains the search_author Form
> in the right side. And the question is where should i locate the
> "search_author" method?
> If at DocumentsController, how could i write the url for
> "search_author"restful?
> If at AuthorsController, how could i connect the AuthorsController
> with the view of DocumentsController?
>
> On 12月6日, 上午12时14分,KlausPieslinger <[EMAIL PROTECTED]>
> wrote:
>
> > AFAIK theRESTfulpart is unrelated to the view part.
> > REST should deal with resources only, so:
> > /documents should return an index of all docs,
> > /authors should return an index of all of them,
> > then an association should be created when POSTing to /authors/
> > id_from_right_pane/documents/id_from_left_pane.
> > It should be usable without defining any view.
> > Afterwards, on top of that, build the view.
--~--~---------~--~----~------------~-------~--~----~
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