/////////// Partial
<%= error_messages_for :company %>
    <% form_remote_for :company , :url =>{:action
=> :update_notif} , :html=>{} do |f| -%>
  <div id="notifications">
    <%= add_notification_link("Add notification") %>
    <table class="list">
      <tr id="tr_id_1"><th>Email</th><th colspan="2">Label</th></tr>
      <%= render :partial => "companies/notification" , :collection =>
@company.notifications%>
    </table>
  </div>
<%= f.submit "Save"%>

    <%end%>

////////// _notification.html.erb

<% new_or_existing = notification.new_record? ? 'new' : 'existing' %>
<% prefix = "company[#{new_or_existing}_notification_attributes][]" %>
<% fields_for prefix, notification do |notification_form| -%>

  <tr>
    <td>
      <% id = new_or_existing == "new" ?
"company_new_notification_attributes_email" : nil %>
      <%= notification_form.text_field_with_auto_complete :email,
{:id=> id} ,
        {:url =>
{:controller=>:autocompletes , :action=>"for_company_notifications_email"},
        :method => :get,
        :frequency=>0.2,
        :skip_style => true,
        :select =>"email",
        :with => "'text_field_val=' + element.value"
      }
    %>
    </td>
    <td>
      <%= notification_form.text_field(:label) %>
    </td>
    <td>
      <%  if new_or_existing == "new" %>
        <%= link_to_function "<img src='/images/delete.png'>", "$
(this).up('tr').remove()" %>
      <% else %>
        <%= link_to_delete :notifications,:destroy,notification.id %>

      <%end%>
    </td>
  </tr>
<% end -%>


On 4 juil, 18:58, Frederick Cheung <[email protected]> wrote:
> On Jul 4, 5:53 pm, fmh <[email protected]> wrote:
>
> > I think I'm not the first to ask this question.
>
> > I have a fields_for within a form_remote_for and this not work
> > properly , the remote_form_for serialize strangely all params passed
> > by fields_for.
>
> What do the params look like ? What does your form look like ?
>
> Fred
>
> > with a form_for it's work perfectly.
>
> > Rails -v = 2.3.8
>
> > any help ?

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