Commit bc05441b by liyijie

Fix view path use class variable

parent 842b17e4
......@@ -15,14 +15,16 @@ class SimpleController::BaseController < ::InheritedResources::Base
protected
mattr_accessor :view_class_path
def self.view_path path
self.view_class_path = path
@view_class_path = path
end
def view_path
self.class.view_class_path ||= begin
self.class.instance_variable_get(:@view_class_path) ||
self.class.instance_variable_set(:@view_class_path, extract_view_path)
end
def extract_view_path
controller_class_path = controller_path.split "/"
if controller_class_path.size > 1
File.join controller_class_path[0], controller_class_path[-1]
......@@ -30,7 +32,6 @@ class SimpleController::BaseController < ::InheritedResources::Base
controller_class_path[-1]
end
end
end
def collection
get_collection_ivar || set_collection_ivar(end_of_association_chain.ransack(params[:q]).result.paginate(page: params[:page], per_page: params[:per_page]))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment