app/controllers/administrate/application_controller.rb in administrate-0.1.0 vs app/controllers/administrate/application_controller.rb in administrate-0.1.1

- old
+ new

@@ -36,11 +36,11 @@ resource = resource_class.new(resource_params) if resource.save redirect_to( [Administrate::NAMESPACE, resource], - notice: translate("create.success"), + notice: translate_with_resource("create.success"), ) else render :new, locals: { page: Administrate::Page::Form.new(dashboard, resource), } @@ -49,22 +49,22 @@ def update if requested_resource.update(resource_params) redirect_to( [Administrate::NAMESPACE, requested_resource], - notice: translate("update.success"), + notice: translate_with_resource("update.success"), ) else render :edit, locals: { page: Administrate::Page::Form.new(dashboard, requested_resource), } end end def destroy requested_resource.destroy - flash[:notice] = translate("destroy.success") + flash[:notice] = translate_with_resource("destroy.success") redirect_to action: :index end private @@ -110,10 +110,10 @@ def resource_resolver @_resource_resolver ||= Administrate::ResourceResolver.new(controller_path) end - def translate(key) + def translate_with_resource(key) t( "administrate.controller.#{key}", resource: resource_resolver.resource_title, ) end