Commit 842b17e4 by liyijie

Add view_path helper method

parent 4bc1df40
......@@ -15,12 +15,21 @@ class SimpleController::BaseController < ::InheritedResources::Base
protected
mattr_accessor :view_class_path
def self.view_path path
@view_class_path = path
self.view_class_path = path
end
def self.view_class_path
@view_class_path
def view_path
self.class.view_class_path ||= begin
controller_class_path = controller_path.split "/"
if controller_class_path.size > 1
File.join controller_class_path[0], controller_class_path[-1]
else
controller_class_path[-1]
end
end
end
def collection
......
......@@ -2,8 +2,4 @@ RSpec.describe SimpleController do
it "has a version number" do
expect(SimpleController::VERSION).not_to be nil
end
it "does something useful" do
expect(false).to eq(true)
end
end
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