Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Rendering problem
module Admin
class AdminController < ApplicationController
def initialize
@datatable_class = "#{self.class.to_s.gsub("Controller", "Datatable")}".constantize
@model_class = "Object::#{self.class.to_s.gsub("Admin::", "").gsub("Controller", "").singularize}".constantize
@param_path = "#{@model_class.to_s.gsub("::", "_").downcase}"
@model_name = "#{@model_class.to_s.demodulize.downcase}"
end
def index
respond_to do |format|
format.html
format.json {
@records = @model_class.all
render json: @datatable_class.new(view_context, @model_class)
}
end
end
end
end
class ApplicationController < ActionController::Base
protect_from_forgery
end
module Admin
module MyModule
class MyModelsController < Admin::AdminController
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.