app/controllers/carnival/base_admin_controller.rb in carnival-0.0.10 vs app/controllers/carnival/base_admin_controller.rb in carnival-0.0.11
- old
+ new
@@ -2,12 +2,12 @@
class BaseAdminController < InheritedResources::Base
respond_to :html, :json
before_filter :authenticate_admin_user!
def generate_datatable
- modelo_presenter = instantiate_presenter
- Carnival::GenericDatatable.new(view_context, instantiate_model, self, modelo_presenter)
+ model_presenter = instantiate_presenter
+ Carnival::GenericDatatable.new(view_context, instantiate_model(model_presenter), self, model_presenter)
end
def index
@datatable = generate_datatable
@advanced_search = params["advanced_search"] if params["advanced_search"].present?
@@ -73,16 +73,11 @@
current_admin_user
end
private
- def instantiate_model
- namespace = extract_namespace
- if namespace.present?
- "#{extract_namespace}::#{controller_name.classify}".constantize
- else
- "#{controller_name.classify}".constantize
- end
+ def instantiate_model(presenter)
+ presenter.full_model_name.classify.constantize
end
def instantiate_presenter
namespace = extract_namespace
if namespace.present?