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
4a40c500
Commit
4a40c500
authored
Jan 01, 2018
by
liyijie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix view path use model collection name
parent
1b884c7e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
simple_controller_generator.rb
...nerators/simple_controller/simple_controller_generator.rb
+7
-1
No files found.
lib/generators/simple_controller/simple_controller_generator.rb
View file @
4a40c500
...
@@ -35,7 +35,9 @@ class SimpleControllerGenerator < Rails::Generators::NamedBase
...
@@ -35,7 +35,9 @@ class SimpleControllerGenerator < Rails::Generators::NamedBase
def
view_path
def
view_path
return
options
.
view
if
options
.
view
.
present?
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
File
.
join
controller_class_path
[
0
],
plural_name
else
else
plural_name
plural_name
...
@@ -111,6 +113,10 @@ class SimpleControllerGenerator < Rails::Generators::NamedBase
...
@@ -111,6 +113,10 @@ class SimpleControllerGenerator < Rails::Generators::NamedBase
resource_class
&
.
model_name
&
.
singular
resource_class
&
.
model_name
&
.
singular
end
end
def
resource_collection
resource_class
&
.
model_name
&
.
collection
end
def
attributes_names
def
attributes_names
begin
begin
resource_class
.
columns
.
map
(
&
:name
)
-
%w(id created_at updated_at)
resource_class
.
columns
.
map
(
&
:name
)
-
%w(id created_at updated_at)
...
...
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