Commit a0d7cf8e by liyijie

Add single model support

parent 41049583
...@@ -97,6 +97,15 @@ class SimpleControllerGenerator < Rails::Generators::NamedBase ...@@ -97,6 +97,15 @@ class SimpleControllerGenerator < Rails::Generators::NamedBase
nil nil
end end
# Second priority is the top namespace model, e.g. EngineName::Article for EngineName::Admin::ArticlesController
@resource_class ||= begin
namespaced_classes = controller_class_name.split('::')
namespaced_class = namespaced_classes[-1].singularize
namespaced_class.constantize
rescue NameError
nil
end
# Otherwise use the Group class, or fail # Otherwise use the Group class, or fail
@resource_class ||= begin @resource_class ||= begin
class_name = controller_class_name.classify class_name = controller_class_name.classify
......
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