Skip to content

Instantly share code, notes, and snippets.

@spacecowb0y
Created November 16, 2011 02:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spacecowb0y/1369085 to your computer and use it in GitHub Desktop.
Save spacecowb0y/1369085 to your computer and use it in GitHub Desktop.
# lib/active_admin/comments.rb
# Always redirect to the resource on show
before_filter :only => :show do
flash[:notice] = flash[:notice].dup if flash[:notice]
comment = ActiveAdmin::Comment.find(params[:id])
resource_config = active_admin_config.namespace.resource_for(comment.resource.class)
# I don't know why this is not working... yet.
# redirect_to send(resource_config.route_instance_path, comment.resource)
# so let's hack the planet
redirect_to "#{url_for(:controller => comment.resource_type.pluralize.downcase)}/#{comment.resource_id}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment