app/controllers/administrate/application_controller.rb in administrate-0.1.2 vs app/controllers/administrate/application_controller.rb in administrate-0.1.3
- old
+ new
@@ -35,11 +35,11 @@
def create
resource = resource_class.new(resource_params)
if resource.save
redirect_to(
- [Administrate::NAMESPACE, resource],
+ [namespace, resource],
notice: translate_with_resource("create.success"),
)
else
render :new, locals: {
page: Administrate::Page::Form.new(dashboard, resource),
@@ -48,11 +48,11 @@
end
def update
if requested_resource.update(resource_params)
redirect_to(
- [Administrate::NAMESPACE, requested_resource],
+ [namespace, requested_resource],
notice: translate_with_resource("update.success"),
)
else
render :edit, locals: {
page: Administrate::Page::Form.new(dashboard, requested_resource),
@@ -103,10 +103,11 @@
def permitted_attributes
dashboard.permitted_attributes
end
- delegate :resource_class, :resource_name, to: :resource_resolver
+ delegate :resource_class, :resource_name, :namespace, to: :resource_resolver
+ helper_method :namespace
def resource_resolver
@_resource_resolver ||=
Administrate::ResourceResolver.new(controller_path)
end