Created
November 16, 2011 02:29
-
-
Save spacecowb0y/1369085 to your computer and use it in GitHub Desktop.
Quick fix for: https://github.com/gregbell/active_admin/issues/708
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
# 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