Hey guys,

I was wondering what would be the best practice/approach to send ajax
request from inside a nested form?
Lemme try to describe it better:

= form_for [@customer, @invoice] do |invoice_form|

  = invoice_form.label :date_issue
  = invoice_form.text_field :date_issue, :class => 'datepicker'

  = invoice_form.fields_for :item_services do |item_fields|
    = item_service.label 'Search for services'
    = item_service.text_field :description

    = item_service.submit 'Search'

= invoice_form.submit 'Create Invoice'

The outer form is the last to be submitted(creates an Invoice) and in the
meanwhile, in the inner form, I'd like to search for an Service and if it
doesn't exists, I'd be rendering some field to create a service and then
keep going on the flow.

This is a many-to-many relationship
*Invoice* ->|--------------|<- *ItemService*

*Invoice* has_and_belongs_to_many
*:item_servicesItemService* has_and_belongs_to_many *:invoices*


Thanks in advance

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAOEz2q-uh2NX0J%3DO05HL5KEAcpczN780VTzZxvsmnrTp8VqMmA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to