Commit 4a40c500 by liyijie

Fix view path use model collection name

parent 1b884c7e
......@@ -35,7 +35,9 @@ class SimpleControllerGenerator < Rails::Generators::NamedBase
def view_path
return options.view if options.view.present?
if controller_class_path.size > 1
if resource_collection.present?
resource_collection
elsif controller_class_path.size > 1
File.join controller_class_path[0], plural_name
else
plural_name
......@@ -111,6 +113,10 @@ class SimpleControllerGenerator < Rails::Generators::NamedBase
resource_class&.model_name&.singular
end
def resource_collection
resource_class&.model_name&.collection
end
def attributes_names
begin
resource_class.columns.map(&:name) - %w(id created_at updated_at)
......
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