Defect #28668
redmine_plugin_controller generates camelcase filename
Status: | Closed | Start date: | ||
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | % Done: | 0% | ||
Category: | Plugin API | |||
Target version: | 4.0.0 | |||
Resolution: | Fixed | Affected version: | 3.4.5 |
Description
redmine_plugin_controller generates not snake case file name but camel case file name when specifying controller name as camel case.
For example:
$ bundle exec rails generate redmine_plugin_controller hello_message FooBars create plugins/hello_message/app/controllers/FooBars_controller.rb create plugins/hello_message/app/helpers/FooBars_helper.rb create plugins/hello_message/test/functional/FooBars_controller_test.rb
This causes
On the other hand, redmine_plugin_model generates snake case file name when specifying model name as camel case.
$ bundle exec rails generate redmine_plugin_model hello_message FooBar create plugins/hello_message/app/models/foo_bar.rb create plugins/hello_message/test/unit/foo_bar_test.rb create plugins/hello_message/db/migrate/004_create_foo_bars.rb
Ruby on Rails' rails generate controller FooBars
command generates snake case file name: 'foo_bars_controller.rb', too.
Environment is as follows
Environment: Redmine version 3.4.5.stable.17297 Ruby version 2.4.3-p205 (2017-12-14) [x86_64-linux] Rails version 4.2.8 Environment production Database adapter SQLite
- trunk has same behavior.
I expect to generate controller file with snake case name even if controller name is specified by camel case, like model file name.
Associated revisions
Fix: redmine_plugin_controller generates camelcase filename (#28668).
Patch by Toru Takahashi.
History
#1
Updated by Toru Takahashi about 4 years ago
- lib/generators/redmine_plugin_controller/redmine_plugin_controller_generator.rb
uses the argument of controller name to generate file name without modification to snake case.
For example,template 'controller.rb.erb', "#{plugin_path}/app/controllers/#{controller}_controller.rb"
- lib/generators/redmine_plugin_model/redmine_plugin_model_generator.rb
uses the argument of model name to generate file name with modification to snake case.
For example,template 'model.rb.erb', "#{plugin_path}/app/models/#{model.underscore}.rb"
I attached a fix patch for redmine_plugin_controller_generator.rb to generate file name with snake case controller name like redmine_plugin_model_generator.rb.
This patch is generate under svn r17297 (3.4-stable branch).
#2
Updated by Go MAEDA about 4 years ago
- Description updated (diff)
#3
Updated by Go MAEDA about 4 years ago
- Target version set to 4.1.0
The patch improves the consistency of the behavior of generators. Setting target version to 4.1.0.
#4
Updated by Go MAEDA about 4 years ago
- Status changed from New to Closed
- Assignee set to Go MAEDA
- Target version changed from 4.1.0 to 4.0.0
- Resolution set to Fixed
Committed. Thank you for your contribution.
FYI: redmine_plugin_model generates snake case filename since r9718.