Created
July 4, 2011 22:42
-
-
Save fabiosussetto/1064023 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#show.js.erb | |
$('#comments').html('<%= escape_javascript render(@comments) %>'); | |
$('#paginator').html('<%= escape_javascript(paginate(@comments, :remote => true).to_s) %>'); | |
#announces_controller.rb | |
def show | |
@announce = Announce.find(params[:id]) | |
@comments = Comment.order("created_at desc").where(:announce_id => @announce.id).includes(:attachments).page(params[:page]).per(10) | |
@comment = @announce.comments.build | |
@comment.attachments.build | |
respond_to do |format| | |
format.html # show.html.erb | |
format.js | |
format.xml { render :xml => @announce } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment