Commit fc265d42 by liyijie

use instance_of? instead_of is_a?

parent a105dda0
...@@ -83,13 +83,12 @@ class SimpleControllerGenerator < Rails::Generators::NamedBase ...@@ -83,13 +83,12 @@ class SimpleControllerGenerator < Rails::Generators::NamedBase
namespaced_classes.delete_at(1) namespaced_classes.delete_at(1)
namespaced_class = namespaced_classes.join('::').singularize namespaced_class = namespaced_classes.join('::').singularize
resource_class = namespaced_class.constantize resource_class = namespaced_class.constantize
raise NameError if resource_class.is_a? Module raise NameError if resource_class.instance_of? Module
resource_class
rescue NameError rescue NameError
nil nil
end end
# Third priority the camelcased c, i.e. UserGroup # Third priority the camelcased c, i.e. UserGroup
@resource_class ||= begin @resource_class ||= begin
camelcased_class = controller_class_name.singularize camelcased_class = controller_class_name.singularize
......
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