Я наконец-то преобразовал CRUD-приложение Rails в AJAX, в котором только одно обновление страницы и все действия контроллера: создание, удаление и редактирование / обновление выполняются AJAX. Довольно аккуратно на самом деле. Есть две остаточные проблемы:
Я застреваю в режиме обновления в верхней части экрана _form частично, потому что я не могу изменить режим кнопки отправки, я хочу, чтобы это было Create после каждого действия, кроме Edit. Как мне это сделать - это с помощью изменения экрана с помощью JQuery или какого-либо действия контроллера.
Вторая проблема выглядит гораздо проще. Когда я оставляю обязательные поля пустыми, приложение выдает ошибку, как и должно быть. В соответствующих файлах js.erb, create.js, erb и update.js.erb указывается путь ошибок, но на экране ошибок нет.
Ниже перечислены соответствующие файлы - Контроллер клиентов, а также различные файлы html.erb и js.erb в представлениях клиентов.
Контроллер клиентов:
class CustomersController < ApplicationController
before_filter :load
def load
@customers = Customer.all
@customer = Customer.new
end
# Display composite form used for AJAX operations.
def index
end
# This method implements customer create action for AJAX request.
def create
@customer = Customer.new(params[:customer])
if @customer.save
flash[:notice] = "Customer Record Created."
@customers = Customer.all
respond_to do |format|
format.js
end
end
end
# This method get customer for editing using AJAX.
def edit
@customer = Customer.find(params[:id])
respond_to do |format|
format.js
end
end
# This method implements customer update from AJAX form.
def update
@customer = Customer.find(params[:id])
if @customer.update_attributes(params[:customer])
flash[:notice] = "Customer Record Updated."
@customers = Customer.all
respond_to do |format|
format.js
end
end
end
# This method implements customer delete from AJAX form.
def destroy
@customer = Customer.find(params[:id])
@customer.destroy
flash[:notice] = "Customer Record Deleted"
@customers = Customer.all
respond_to do |format|
format.js
end
end
# This method lists all customers on file.
def getcustsjson
render :json => @customers
end
# This method lists all the books purchased by a particular customer.
def getbooksjson
@customer = Customer.find(params[:id])
@order = @customer.order
@orderitems = Orderitem.find_all_by_order_id(@order)
@book = Book.find_all_by_id(@orderitems)
render :json => @book
end
end
Форма указателя:
<div id="customer_form"><%= render 'form' %></div>
<div id="customers_list"><%= render 'customers' %></div>
_Form Частично с кнопкой отправки:
<%= form_for(@customer, :remote => true) do |f| %>
<div id="customer_errors" style="display:none"></div>
<div class="field">
<%= f.label :firstname %>
<%= f.text_field :firstname %>
<%= f.label :lastname %>
<%= f.text_field :lastname %>
</div>
<div class="field">
<%= f.label :email %>
<%= f.text_field :email %>
<%= f.label :phone %>
<%= f.text_field :phone %>
</div>
<div class="field">
<%= f.label :password %>
<%= f.text_field :password %>
<%= f.label :address_id %>
<%= f.text_field :address_id %>
</div>
<div class="actions">
<%= f.submit %>
</div>
<% end %>
_ Частичные клиенты:
<table>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Email</th>
<th>Phone</th>
<th>Password</th>
<th>Address</th>
<th></th>
<th></th>
<th></th>
</tr>
<% @customers.each do |customer| %>
<tr>
<td><%= customer.firstname %></td>
<td><%= customer.lastname %></td>
<td><%= customer.email %></td>
<td><%= customer.phone %></td>
<td><%= customer.password %></td>
<td><%= customer.address_id %></td>
<td><%= link_to 'Edit', edit_customer_path(customer), :remote => true %></td>
<td><%= link_to 'Destroy', customer, :remote => true, :confirm => 'Are you sure?', :method => :delete %></td>
</tr>
<% end %>
</table>
Файл Create.js.erb с кодом ошибки:
<% if @customer.errors.any? -%>
/* Hide the Flash Notice div */
$("#flash_notice").hide(300);
/* Update the html of the div customer_errors with the new one */
$("#customer_errors").html("<% @customer.errors.full_messages.each do |msg| %>
<li><%= escape_javascript ( msg ) %></li>
<% end %>");
/* Show the div customer_errors */
$("#customer_errors").show(300);
<% else -%>
/* Hide the div customer_errors */
$("#customer_errors").hide(300);
/* Update the html of the div flash_notice with the new one */
$("#flash_notice").html("<%= flash[:notice] %>");
/* Show the flash_notice div */
$("#flash_notice").show(300);
/* Clear the entire form */
$(":input:not(input[type=submit])").val("");
/* Replace the html of the div customers_list with the updated new one */
$("#customers_list").html("<%= escape_javascript render('customers') %>");
<% end %>
Код Edit.js.erb:
$("#customer_form").html("<%= escape_javascript render('form') %>");
Update.js.erb код с ошибкой код:
<% if @customer.errors.any? -%>
$("#flash_notice").hide(300);
$("#customer_errors").html("<% @customer.errors.full_messages.each do |msg| %>
<li><%= escape_javascript ( msg ) %></li>
<% end %>");
$("#customer_errors").show(300);
<% else -%>
$("#customer_errors").hide(300);
$("#flash_notice").html("<%= flash[:notice] %>");
$(":input:not(input[type=submit])").val("");
$("#customer_form").html("<%= escape_javascript render('form') %>");
$("#customers_list").html("<%= escape_javascript render('customers') %>");
<% end %>
и, наконец, Destroy.js.erb, который мне нужно сбросить для создания режима после выполнения:
$("#customer_errors").hide(300);
$("#flash_notice").html("<%= flash[:notice] %>");
$("#flash_notice").show(300);
$("#customers_list").html("<%= escape_javascript render('customers') %>");
$("#customer_form").html("<%= escape_javascript render('form') %>");
Если что-то еще нужно - пожалуйста, спросите.
РЕДАКТИРОВАТЬ:
Теперь у меня есть еще одна проблема в том, что действие Edit не работает должным образом. При просмотре журнала транзакция проведена должным образом, но в ответе верхняя часть формы остается неизменной, а не отображаются детали записи, подлежащей обновлению. Я вставил последний код контроллера.
РЕДАКТИРОВАТЬ II:
Кажется, проблема в том, что обновления DOM для div customer_errors и div customer_form не обрабатываются. В отличие от этого все обновления div customer_list обрабатываются нормально. Я включил ниже содержимое респона для обоих типов сообщений, а также список источников из браузера, показывающий ожесточенные div.
Источник из браузера:
<!DOCTYPE html>
<html>
<head>
<title>OnlineBookStore</title>
<link href="/stylesheets/scaffold.css?1323327452" media="screen" rel="stylesheet" type="text/css" />
<script src="/javascripts/jquery.js?1323855673" type="text/javascript"></script>
<script src="/javascripts/jquery-ui.js?1323855673" type="text/javascript"></script>
<script src="/javascripts/jquery_ujs.js?1323855673" type="text/javascript"></script>
<script src="/javascripts/application.js?1323327452" type="text/javascript"></script>
<meta name="csrf-param" content="authenticity_token"/>
<meta name="csrf-token" content="CROTodz0FR1ZJpl+Lp4xL0fh6Dx8ydu6Ge5OBSV23g4="/>
</head>
<body>
<div id="container">
<div id="flash_notice" style="display:none"></div
<div id="customer_form">
<form accept-charset="UTF-8" action="/customers" class="new_customer" data-remote="true" id="new_customer" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /><input name="authenticity_token" type="hidden" value="CROTodz0FR1ZJpl+Lp4xL0fh6Dx8ydu6Ge5OBSV23g4=" /></div>
<div id="customer_errors" style="display:none"></div>
<div class="field">
<label for="customer_firstname">Firstname</label>
<input id="customer_firstname" name="customer[firstname]" size="30" type="text" />
<label for="customer_Lastname">Lastname</label>
<input id="customer_lastname" name="customer[lastname]" size="30" type="text" />
</div>
<div class="field">
<label for="customer_email">Email</label>
<input id="customer_email" name="customer[email]" size="30" type="text" />
<label for="customer_phone">Phone</label>
<input id="customer_phone" name="customer[phone]" size="30" type="text" />
</div>
<div class="field">
<label for="customer_password">Password</label>
<input id="customer_password" name="customer[password]" size="30" type="text" />
<label for="customer_address_id">Address</label>
<input id="customer_address_id" name="customer[address_id]" size="30" type="text" />
</div>
<div class="actions">
<input id="customer_submit" name="commit" type="submit" value="Create Customer" />
</div>
</form></div>
<div id="customers_list">
<table>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Email</th>
<th>Phone</th>
<th>Password</th>
<th>Address</th>
<th></th>
<th></th>
<th></th>
</tr>
<tr>
<td>Jonathan </td>
<td>McCarthy</td>
<td>jonathan.mccarthy@ncirl.ie</td>
<td>083 4342009</td>
<td>letmeinsoon</td>
<td>1</td>
<td><a href="/customers/1/edit" data-remote="true">Edit</a></td>
<td><a href="/customers/1" data-confirm="Are you sure?" data-method="delete" data-remote="true" rel="nofollow">Destroy</a></td>
</tr>
<tr>
<td>Joseph</td>
<td>McGouran</td>
<td>joe_mcgouran@yahoo.ie</td>
<td>086 2210662</td>
<td>accesssought</td>
<td>1</td>
<td><a href="/customers/3/edit" data-remote="true">Edit</a></td>
<td><a href="/customers/3" data-confirm="Are you sure?" data-method="delete" data-remote="true" rel="nofollow">Destroy</a></td>
</tr>
<tr>
<td>Marie</td>
<td>McGouran</td>
<td>mariemcgouran@yahoo.co.uk</td>
<td>2988858</td>
<td>dontmesswithme</td>
<td>1</td>
<td><a href="/customers/4/edit" data-remote="true">Edit</a></td>
<td><a href="/customers/4" data-confirm="Are you sure?" data-method="delete" data-remote="true" rel="nofollow">Destroy</a></td>
</tr>
<tr>
<td>Stephen </td>
<td>McGouran</td>
<td>stephenmcgouran@gmail.com</td>
<td>2988858</td>
<td>whogoesthere</td>
<td>1</td>
<td><a href="/customers/7/edit" data-remote="true">Edit</a></td>
<td><a href="/customers/7" data-confirm="Are you sure?" data-method="delete" data-remote="true" rel="nofollow">Destroy</a></td>
</tr>
<tr>
<td>Cathy </td>
<td>McGouran</td>
<td>cathymcgouran@gmail.com</td>
<td>2988858</td>
<td>openthedoor</td>
<td>1</td>
<td><a href="/customers/8/edit" data-remote="true">Edit</a></td>
<td><a href="/customers/8" data-confirm="Are you sure?" data-method="delete" data-remote="true" rel="nofollow">Destroy</a></td>
</tr>
<tr>
<td>Peter </td>
<td>McGouran</td>
<td>petermcgouran@gmail.com</td>
<td>74931548</td>
<td>open sesame</td>
<td>1</td>
<td><a href="/customers/9/edit" data-remote="true">Edit</a></td>
<td><a href="/customers/9" data-confirm="Are you sure?" data-method="delete" data-remote="true" rel="nofollow">Destroy</a></td>
</tr>
<tr>
<td>Gary</td>
<td>McGouran</td>
<td>garymcgouran@gmail.com</td>
<td>5566779824</td>
<td>pilotgogo</td>
<td>1</td>
<td><a href="/customers/11/edit" data-remote="true">Edit</a></td>
<td><a href="/customers/11" data-confirm="Are you sure?" data-method="delete" data-remote="true" rel="nofollow">Destroy</a></td>
</tr>
<tr>
<td>Matthew</td>
<td>Busby</td>
<td>mattbusby@gmail.com</td>
<td>76588888</td>
<td>babesteam</td>
<td>1</td>
<td><a href="/customers/15/edit" data-remote="true">Edit</a></td>
<td><a href="/customers/15" data-confirm="Are you sure?" data-method="delete" data-remote="true" rel="nofollow">Destroy</a></td>
</tr>
<tr>
<td>John </td>
<td>Beales</td>
<td>johnbeales@yahoo.com</td>
<td>9988664433</td>
<td>russiantripper</td>
<td>1</td>
<td><a href="/customers/20/edit" data-remote="true">Edit</a></td>
<td><a href="/customers/20" data-confirm="Are you sure?" data-method="delete" data-remote="true" rel="nofollow">Destroy</a></td>
</tr>
<tr>
<td>Brian</td>
<td>Wade</td>
<td>bbwade@gmail.com</td>
<td>9999998888</td>
<td>wadeoff</td>
<td>1</td>
<td><a href="/customers/30/edit" data-remote="true">Edit</a></td>
<td><a href="/customers/30" data-confirm="Are you sure?" data-method="delete" data-remote="true" rel="nofollow">Destroy</a></td>
</tr>
<tr>
<td>Yasser</td>
<td>Arafat</td>
<td>yasser@Gmail.com</td>
<td>9999999-999</td>
<td>speaksoftly my friend</td>
<td>1</td>
<td><a href="/customers/31/edit" data-remote="true">Edit</a></td>
<td><a href="/customers/31" data-confirm="Are you sure?" data-method="delete" data-remote="true" rel="nofollow">Destroy</a></td>
</tr>
<tr>
<td>MIchael </td>
<td>Sweeney</td>
<td>mick@ntma.com</td>
<td>456278</td>
<td>mickn</td>
<td>2</td>
<td><a href="/customers/35/edit" data-remote="true">Edit</a></td>
<td><a href="/customers/35" data-confirm="Are you sure?" data-method="delete" data-remote="true" rel="nofollow">Destroy</a></td>
</tr>
<tr>
<td>MIchael</td>
<td>Semple</td>
<td>mibksemp@gmail.com</td>
<td>0044897345</td>
<td>micko</td>
<td>1</td>
<td><a href="/customers/36/edit" data-remote="true">Edit</a></td>
<td><a href="/customers/36" data-confirm="Are you sure?" data-method="delete" data-remote="true" rel="nofollow">Destroy</a></td>
</tr>
<tr>
<td>Harry</td>
<td>Potter</td>
<td>harrypot@gmail.com</td>
<td>086332123</td>
<td>wizard</td>
<td>1</td>
<td><a href="/customers/39/edit" data-remote="true">Edit</a></td>
<td><a href="/customers/39" data-confirm="Are you sure?" data-method="delete" data-remote="true" rel="nofollow">Destroy</a></td>
</tr>
</table>
</div>
</div>
</body>
</html
JS, отправленный с сервера для сообщений об ошибках, показан ниже. С div customer_errors ничего не происходит:
/* Hide the Flash Notice div */
/* Update the html of the div customer_errors with the new one */
/* Show the div customer_errors */
$("#flash_notice").hide(300);
$("#customer_errors").html(
<li>Phone can\'t be blank</li>
<li>Password can\'t be blank</li>
<li>Address can\'t be blank</li>
);
$("#customer_errors").show(300);
JS, отправленный с сервера для действия редактирования, выглядит следующим образом. Похоже, я не могу выяснить в firebug, есть ли какая-то ошибка в строке обновления Div:
$("#customer_form").html("\n<form accept-charset=\"UTF-8\" action=\"/customers/4\" class=\"edit_customer\" data-remote=\"true\" id=\"edit_customer_4\" method=\"post\"><div style=\"margin:0;padding:0;display:inline\"><input name=\"utf8\" type=\"hidden\" value=\"✓\" /><input name=\"_method\" type=\"hidden\" value=\"put\" /><input name=\"authenticity_token\" type=\"hidden\" value=\"mOAikAY8A22vPmNYzLWWm64lPU22imzIA/jOcXQVhAw=\" /><\/div>\n\n <div id=\"customer_errors\" style=\"display:none\"><\/div>\n\n <div class=\"field\">\n <label for=\"customer_firstname\">Firstname<\/label>\n <input id=\"customer_firstname\" name=\"customer[firstname]\" size=\"30\" type=\"text\" value=\"Marie\" />\n <label for=\"customer_Lastname\">Lastname<\/label>\n <input id=\"customer_lastname\" name=\"customer[lastname]\" size=\"30\" type=\"text\" value=\"McGouran\" />\n <\/div>\n <div class=\"field\">\n <label for=\"customer_email\">Email<\/label>\n <input id=\"customer_email\" name=\"customer[email]\" size=\"30\" type=\"text\" value=\"mariemcgouran@yahoo.co.uk\" />\n <label for=\"customer_phone\">Phone<\/label>\n <input id=\"customer_phone\" name=\"customer[phone]\" size=\"30\" type=\"text\" value=\"2988858\" />\n <\/div>\n <div class=\"field\">\n <label for=\"customer_password\">Password<\/label>\n <input id=\"customer_password\" name=\"customer[password]\" size=\"30\" type=\"text\" value=\"dontmesswithme\" />\n <label for=\"customer_address_id\">Address<\/label>\n <input id=\"customer_address_id\" name=\"customer[address_id]\" size=\"30\" type=\"text\" value=\"1\" />\n <\/div>\n <div class=\"actions\">\n <input id=\"customer_submit\" name=\"commit\" type=\"submit\" value=\"Update Customer\" />\n <\/div>\n<\/form>");
Это JS, сгенерированный после успешной новой записи. ЭТО работает:
/* Hide the div customer_errors */
/* Update the html of the div flash_notice with the new one */
/* Clear the form */
/* Replace the html of the div customers_list with the updated one */
$("#customer_errors").hide(300);
$("#flash_notice").html("Customer Record Created.");
$("#flash_notice").show(300);
$(":input:not(input[type=submit])").val("");
$("#customers_list").html("\n<table>\n <tr>\n <th>Firstname<\/th>\n <th>Lastname<\/th>\n <th>Email<\/th>\n <th>Phone<\/th>\n <th>Password<\/th>\n <th>Address<\/th>\n <th><\/th>\n <th><\/th>\n <th><\/th>\n <\/tr>\n\n <tr>\n <td>Jonathan <\/td>\n <td>McCarthy<\/td>\n <td>jonathan.mccarthy@ncirl.ie<\/td>\n <td>083 4342009<\/td>\n <td>letmeinsoon<\/td>\n <td>1<\/td>\n <td><a href=\"/customers/1/edit\" data-remote=\"true\">Edit<\/a><\/td>\n <td><a href=\"/customers/1\" data-confirm=\"Are you sure?\" data-method=\"delete\" data-remote=\"true\" rel=\"nofollow\">Destroy<\/a><\/td>\n <\/tr>\n <tr>\n <td>Joseph<\/td>\n <td>McGouran<\/td>\n <td>joe_mcgouran@yahoo.ie<\/td>\n <td>086 2210662<\/td>\n <td>accesssought<\/td>\n <td>1<\/td>\n <td><a href=\"/customers/3/edit\" data-remote=\"true\">Edit<\/a><\/td>\n <td><a href=\"/customers/3\" data-confirm=\"Are you sure?\" data-method=\"delete\" data-remote=\"true\" rel=\"nofollow\">Destroy<\/a><\/td>\n <\/tr>\n <tr>\n <td>Marie<\/td>\n <td>McGouran<\/td>\n <td>mariemcgouran@yahoo.co.uk<\/td>\n <td>2988858<\/td>\n <td>dontmesswithme<\/td>\n <td>1<\/td>\n <td><a href=\"/customers/4/edit\" data-remote=\"true\">Edit<\/a><\/td>\n <td><a href=\"/customers/4\" data-confirm=\"Are you sure?\" data-method=\"delete\" data-remote=\"true\" rel=\"nofollow\">Destroy<\/a><\/td>\n <\/tr>\n <tr>\n <td>Stephen <\/td>\n <td>McGouran<\/td>\n <td>stephenmcgouran@gmail.com<\/td>\n <td>2988858<\/td>\n <td>whogoesthere<\/td>\n <td>1<\/td>\n <td><a href=\"/customers/7/edit\" data-remote=\"true\">Edit<\/a><\/td>\n <td><a href=\"/customers/7\" data-confirm=\"Are you sure?\" data-method=\"delete\" data-remote=\"true\" rel=\"nofollow\">Destroy<\/a><\/td>\n <\/tr>\n <tr>\n <td>Cathy <\/td>\n <td>McGouran<\/td>\n <td>cathymcgouran@gmail.com<\/td>\n <td>2988858<\/td>\n <td>openthedoor<\/td>\n <td>1<\/td>\n <td><a href=\"/customers/8/edit\" data-remote=\"true\">Edit<\/a><\/td>\n <td><a href=\"/customers/8\" data-confirm=\"Are you sure?\" data-method=\"delete\" data-remote=\"true\" rel=\"nofollow\">Destroy<\/a><\/td>\n <\/tr>\n <tr>\n <td>Peter <\/td>\n <td>McGouran<\/td>\n <td>petermcgouran@gmail.com<\/td>\n <td>74931548<\/td>\n <td>open sesame<\/td>\n <td>1<\/td>\n <td><a href=\"/customers/9/edit\" data-remote=\"true\">Edit<\/a><\/td>\n <td><a href=\"/customers/9\" data-confirm=\"Are you sure?\" data-method=\"delete\" data-remote=\"true\" rel=\"nofollow\">Destroy<\/a><\/td>\n <\/tr>\n <tr>\n <td>Gary<\/td>\n <td>McGouran<\/td>\n <td>garymcgouran@gmail.com<\/td>\n <td>5566779824<\/td>\n <td>pilotgogo<\/td>\n <td>1<\/td>\n <td><a href=\"/customers/11/edit\" data-remote=\"true\">Edit<\/a><\/td>\n <td><a href=\"/customers/11\" data-confirm=\"Are you sure?\" data-method=\"delete\" data-remote=\"true\" rel=\"nofollow\">Destroy<\/a><\/td>\n <\/tr>\n <tr>\n <td>John <\/td>\n <td>Beales<\/td>\n <td>johnbeales@yahoo.com<\/td>\n <td>9988664433<\/td>\n <td>russiantripper<\/td>\n <td>1<\/td>\n <td><a href=\"/customers/20/edit\" data-remote=\"true\">Edit<\/a><\/td>\n <td><a href=\"/customers/20\" data-confirm=\"Are you sure?\" data-method=\"delete\" data-remote=\"true\" rel=\"nofollow\">Destroy<\/a><\/td>\n <\/tr>\n <tr>\n <td>MIchael <\/td>\n <td>Sweeney<\/td>\n <td>mick@ntma.com<\/td>\n <td>456278<\/td>\n <td>mickn<\/td>\n <td>2<\/td>\n <td><a href=\"/customers/35/edit\" data-remote=\"true\">Edit<\/a><\/td>\n <td><a href=\"/customers/35\" data-confirm=\"Are you sure?\" data-method=\"delete\" data-remote=\"true\" rel=\"nofollow\">Destroy<\/a><\/td>\n <\/tr>\n <tr>\n <td>bbbbbb<\/td>\n <td>ddddddddd<\/td>\n <td>gggggggg<\/td>\n <td>9999999999<\/td>\n <td>enterin<\/td>\n <td>1<\/td>\n <td><a href=\"/customers/48/edit\" data-remote=\"true\">Edit<\/a><\/td>\n <td><a href=\"/customers/48\" data-confirm=\"Are you sure?\" data-method=\"delete\" data-remote=\"true\" rel=\"nofollow\">Destroy<\/a><\/td>\n <\/tr>\n<\/table>\n\n\n");
Вот JS, сгенерированный после успешного удаления. Это похоже на действие после успешного создания записи.
/* hide customer_errors div */
/* show flash notice */
/* send script to update customers_list div with new customers list */
$("#customer_errors").hide(300);
$("#flash_notice").html("Customer Record Deleted");
$("#flash_notice").show(300);
$("#customers_list").html("\n<table>\n <tr>\n <th>Firstname<\/th>\n <th>Lastname<\/th>\n <th>Email<\/th>\n <th>Phone<\/th>\n <th>Password<\/th>\n <th>Address<\/th>\n <th><\/th>\n <th><\/th>\n <th><\/th>\n <\/tr>\n\n <tr>\n <td>Jonathan <\/td>\n <td>McCarthy<\/td>\n <td>jonathan.mccarthy@ncirl.ie<\/td>\n <td>083 4342009<\/td>\n <td>letmeinsoon<\/td>\n <td>1<\/td>\n <td><a href=\"/customers/1/edit\" data-remote=\"true\">Edit<\/a><\/td>\n <td><a href=\"/customers/1\" data-confirm=\"Are you sure?\" data-method=\"delete\" data-remote=\"true\" rel=\"nofollow\">Destroy<\/a><\/td>\n <\/tr>\n <tr>\n <td>Joseph<\/td>\n <td>McGouran<\/td>\n <td>joe_mcgouran@yahoo.ie<\/td>\n <td>086 2210662<\/td>\n <td>accesssought<\/td>\n <td>1<\/td>\n <td><a href=\"/customers/3/edit\" data-remote=\"true\">Edit<\/a><\/td>\n <td><a href=\"/customers/3\" data-confirm=\"Are you sure?\" data-method=\"delete\" data-remote=\"true\" rel=\"nofollow\">Destroy<\/a><\/td>\n <\/tr>\n <tr>\n <td>Marie<\/td>\n <td>McGouran<\/td>\n <td>mariemcgouran@yahoo.co.uk<\/td>\n <td>2988858<\/td>\n <td>dontmesswithme<\/td>\n <td>1<\/td>\n <td><a href=\"/customers/4/edit\" data-remote=\"true\">Edit<\/a><\/td>\n <td><a href=\"/customers/4\" data-confirm=\"Are you sure?\" data-method=\"delete\" data-remote=\"true\" rel=\"nofollow\">Destroy<\/a><\/td>\n <\/tr>\n <tr>\n <td>Stephen <\/td>\n <td>McGouran<\/td>\n <td>stephenmcgouran@gmail.com<\/td>\n <td>2988858<\/td>\n <td>whogoesthere<\/td>\n <td>1<\/td>\n <td><a href=\"/customers/7/edit\" data-remote=\"true\">Edit<\/a><\/td>\n <td><a href=\"/customers/7\" data-confirm=\"Are you sure?\" data-method=\"delete\" data-remote=\"true\" rel=\"nofollow\">Destroy<\/a><\/td>\n <\/tr>\n <tr>\n <td>Cathy <\/td>\n <td>McGouran<\/td>\n <td>cathymcgouran@gmail.com<\/td>\n <td>2988858<\/td>\n <td>openthedoor<\/td>\n <td>1<\/td>\n <td><a href=\"/customers/8/edit\" data-remote=\"true\">Edit<\/a><\/td>\n <td><a href=\"/customers/8\" data-confirm=\"Are you sure?\" data-method=\"delete\" data-remote=\"true\" rel=\"nofollow\">Destroy<\/a><\/td>\n <\/tr>\n <tr>\n <td>Peter <\/td>\n <td>McGouran<\/td>\n <td>petermcgouran@gmail.com<\/td>\n <td>74931548<\/td>\n <td>open sesame<\/td>\n <td>1<\/td>\n <td><a href=\"/customers/9/edit\" data-remote=\"true\">Edit<\/a><\/td>\n <td><a href=\"/customers/9\" data-confirm=\"Are you sure?\" data-method=\"delete\" data-remote=\"true\" rel=\"nofollow\">Destroy<\/a><\/td>\n <\/tr>\n <tr>\n <td>Gary<\/td>\n <td>McGouran<\/td>\n <td>garymcgouran@gmail.com<\/td>\n <td>5566779824<\/td>\n <td>pilotgogo<\/td>\n <td>1<\/td>\n <td><a href=\"/customers/11/edit\" data-remote=\"true\">Edit<\/a><\/td>\n <td><a href=\"/customers/11\" data-confirm=\"Are you sure?\" data-method=\"delete\" data-remote=\"true\" rel=\"nofollow\">Destroy<\/a><\/td>\n <\/tr>\n <tr>\n <td>John <\/td>\n <td>Beales<\/td>\n <td>johnbeales@yahoo.com<\/td>\n <td>9988664433<\/td>\n <td>russiantripper<\/td>\n <td>1<\/td>\n <td><a href=\"/customers/20/edit\" data-remote=\"true\">Edit<\/a><\/td>\n <td><a href=\"/customers/20\" data-confirm=\"Are you sure?\" data-method=\"delete\" data-remote=\"true\" rel=\"nofollow\">Destroy<\/a><\/td>\n <\/tr>\n <tr>\n <td>MIchael <\/td>\n <td>Sweeney<\/td>\n <td>mick@ntma.com<\/td>\n <td>456278<\/td>\n <td>mickn<\/td>\n <td>2<\/td>\n <td><a href=\"/customers/35/edit\" data-remote=\"true\">Edit<\/a><\/td>\n <td><a href=\"/customers/35\" data-confirm=\"Are you sure?\" data-method=\"delete\" data-remote=\"true\" rel=\"nofollow\">Destroy<\/a><\/td>\n <\/tr>\n<\/table>\n\n\n");
Из вышесказанного ясно, что div "customer_list" всегда обновляется без проблем, тогда как "customer_form" и "customer_errors" не обновляются вовсе.