Skip to content

Instantly share code, notes, and snippets.

@rafaelss
Created April 28, 2011 14:17
Show Gist options
  • Save rafaelss/946424 to your computer and use it in GitHub Desktop.
Save rafaelss/946424 to your computer and use it in GitHub Desktop.
before_filter :load_comments, :only => [ :index, :create ]
def index
end
def create
@comment = Comment.new(params[:comment])
if @comment.save
render 'index'
end
end
private
def load_comments
@comments = @commentable.comments
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment