magiclabs/alchemy_cms — Issue #149: Errors in alchemy-managed resources residing in main app
Author: masche842
Created: 2012-01-20 09:04:01+00:00
State: open
Labels: bug, edge

When a controller inherits Alchemy::Admin::ResourcesController to manage the related resource in Alchemy and when this resource is in the main app, the following error is thrown:

Error: undefined method `new_admin_resource_path' for #<#:0x007faa37d2b818>

where resource is the resources name.

This can be resolved by call the path-helper on the engines main_app-Helper:

# alchemy_cms/app/views/alchemy/admin/resources/index.html.erb
:url => main_app.send("new_admin_#{resource_model_name}_path")

Unfortunately there is a second exception raised then:

Error: No route matches {:controller=>"admin/products"}

I think it's somehow related to the declarative_authorization-gem, called from base_helper's toolbar_button-method. I wasn't able to track it further.

Can you reproduce it an your systems? Or do I just missed something when inheriting from resource-controller?

Another strange thing: In alchemy_crm the default resources index-view is overwritten. If I try the same inside my app (to get around the errors mentioned above) it still renders the default index view.