global

def create

def create
  create! do |success, failure|
    # FYI: below we call `resource.resource`. First is the comment, second is the associated resource.
    resource_config = active_admin_config.namespace.resource_for resource.resource.class
    resource_url    = resource_config.route_instance_path        resource.resource
    success.html{ redirect_to resource_url }
    failure.html do
      flash[:error] = I18n.t('active_admin.comments.errors.empty_text')
      redirect_to resource_url
    end
  end
end