Skip to content

Commit

Permalink
Enable link_to remote (p130-131)
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanbibat committed Sep 4, 2011
1 parent 00f518a commit 99a494b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 8 additions & 1 deletion app/controllers/messages_controller.rb
Expand Up @@ -12,7 +12,14 @@ def index
end

def message_table
render :partial => Message.order("created_at DESC")
respond_to do |format|
format.js do
render :update do |page|
page.replace_html :message_list, :partial => Message.order("created_at DESC")
end
end
format.html { render :partial => Message.order("created_at DESC") }
end
end

# POST /messages
Expand Down
2 changes: 2 additions & 0 deletions app/views/messages/index.html.erb
Expand Up @@ -28,6 +28,8 @@
</div>
<% end %>
<%= link_to "Refresh List", message_table_messages_path, :remote => true %>

<h2>Messages</h2>

<ul style="list-style-type:none;font-size:125%;line-height:150%" id="message_list">
Expand Down

0 comments on commit 99a494b

Please sign in to comment.