Hello guys
I have animals/index.html.erb
<p>
<%= link_to_remote('List',:update => 'cont', :url => {:action =>
:list})%>
</p>
<div id="cont">
<p>page list</p>
</div>
And animals/list.html.erb
<div id="cont">
<%= render :partial => 'list'%>
</div>
And animals/_list.html.erb
<table>
<tr>
<th>Name</th>
<th>Desc</th>
</tr>
<% @animals.each do |animal| %>
<tr>
<td><%=h animal.name %></td>
<td><%=h animal.desc %></td>
<td><%= link_to 'Show', animal %></td>
<td><%= link_to 'Edit', edit_animal_path(animal) %></td>
<td><%= link_to 'Destroy', animal, :confirm => 'Are you sure?',
:method => :delete %></td>
</tr>
<% end %>
</table>
<%= will_paginate @animals %>
and controller
def list
@animals = Animal.paginate(:page => params[:page], :per_page => 3)
respond_to do |format|
format.html
format.js {
render :update do |page|
page.replace_html 'cont', :partial => 'list'
end
}
end
end
then i got following o/p
try { Element.update("cont", "
\n \n Name\n Desc\n
\n\n\n \n dog\n dog\n Show\n Edit\n
\\n \\n Name\\n Desc\\n
\\n\\n\\n \\n dog\\n dog\\n Show\\n Edit\\n Destroy\\n
\\n\\n \\n horse\\n horse\\n Show\\n Edit\\n Destroy\\n
\\n\\n \\n cow\\n cow\\n Show\\n Edit\\n Destroy\\n
\\n\\n
\\n
« Previous 1 2 Next »
\");'); throw e }
if any solution please give me
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---