Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
simple_controller
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
simple_controller
Commits
fc265d42
Commit
fc265d42
authored
Jan 12, 2018
by
liyijie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use instance_of? instead_of is_a?
parent
a105dda0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
3 deletions
+2
-3
simple_controller_generator.rb
...nerators/simple_controller/simple_controller_generator.rb
+2
-3
No files found.
lib/generators/simple_controller/simple_controller_generator.rb
View file @
fc265d42
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment