aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/generators/named_base.rb
Commit message (Collapse)AuthorAgeFilesLines
* [Railties] require => require_relativeAkira Matsuda2017-07-011-2/+2
|
* Fix rubocop violationsyuuji.yaginuma2017-04-121-1/+1
|
* add field ids when generating a scaffold form.Yves Senn2017-03-261-0/+4
| | | | | | This is a follow up to a6d065e. When using `form_with` you must supply field ids manually. Since the scaffold generator is using labels we need to make sure that they are linked up properly.
* Fix generator command for nested (namespaced) rails engine (take 2)Fumiaki MATSUSHIMA2017-01-071-2/+6
| | | | | | | | | | | | | | | | | | | Rewrite https://github.com/rails/rails/pull/27550 085546df45 was reverted (b6ffb5efcb) because it change the return of `namespaced_path` from String to Array. ---------------- If we create nested (namespaced) rails engine such like bukkits-admin, `bin/rails g scaffold User name:string age:integer` will create `bukkits-admin/app/controllers/bukkits/users_controller.rb` but it should create `bukkits-admin/app/controllers/bukkits/admin/users_controller.rb`. In #6643, we changed `namespaced_path` as root path because we supposed application_controller is always in root but nested rails engine's application_controller will not.
* `self.` is not needed when calling its own instance methodAkira Matsuda2017-01-051-1/+1
| | | | Actually, private methods cannot be called with `self.`, so it's not just redundant, it's a bad habit in Ruby
* Revert "Merge pull request #27550 from ↵Rafael Mendonça França2017-01-031-2/+2
| | | | | | | | | mtsmfm/fix-generator-command-for-nested-rails-engine" This reverts commit 1e969bfb98b88799e2c759fce25a1d8cf00d7ce7, reversing changes made to a5041f267ded119c2d00b8786c2f2c1e3f93c8a1. Reason: It breaks the public API
* Fix generator command for nested (namespaced) rails engineFumiaki MATSUSHIMA2017-01-031-2/+2
| | | | | | | | | | | | | If we create nested (namespaced) rails engine such like bukkits-admin, `bin/rails g scaffold User name:string age:integer` will create `bukkits-admin/app/controllers/bukkits/users_controller.rb` but it should create `bukkits-admin/app/controllers/bukkits/admin/users_controller.rb`. In #6643, we changed `namespaced_path` as root path because we supposed application_controller is always in root but nested rails engine's application_controller will not.
* Privatize unneededly protected methods in RailtiesAkira Matsuda2016-12-251-36/+38
|
* Describe what we are protectingAkira Matsuda2016-12-231-0/+2
|
* Remove unused method `namespaced_file_path`Fumiaki MATSUSHIMA2016-12-141-4/+0
| | | | | | | | ``` $ git grep namespaced_file_path railties/lib/rails/generators/named_base.rb: def namespaced_file_path railties/lib/rails/generators/named_base.rb: @namespaced_file_path ||= namespaced_class_path.join("/") ```
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-1/+1
|
* Add three new rubocop rulesRafael Mendonça França2016-08-161-2/+2
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* code gardening: removes redundant selfsXavier Noria2016-08-081-1/+1
| | | | | | | | | A few have been left for aesthetic reasons, but have made a pass and removed most of them. Note that if the method `foo` returns an array, `foo << 1` is a regular push, nothing to do with assignments, so no self required.
* applies new string literal convention in railties/libXavier Noria2016-08-061-12/+12
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Cable: Generate .js or .coffee files while generating channel as per the ↵Prathamesh Sonpatki2016-05-171-0/+4
| | | | | | | | | | | | | | | | | | | | | javascript engine of the application - Now we will detect what javascript engine user is using and based on that we will generate either `.js` or `.coffee` version of the channel file. - This also needs a change in coffee-rails to override the `js_template` method. Related PR https://github.com/rails/coffee-rails/pull/72. - Currently coffee-rails gem sets `config.app_generators.javascript_engine` to `:coffee` and using this information we override the `js_template` to set the extension as `.coffee` in coffee-rails gem. - Using this approach, we can keep the `channel.js` and `channel.coffee` files in the Rails repository itself. - Additionally the `js_template` method can act as public interface for coffee-rails gem to hook into and change the extension to `.coffee` without maintaining the actual asset files. [Prathamesh Sonpatki, Matthew Draper]
* make generated controller test work correctlyyuuji.yaginuma2016-01-061-0/+4
| | | | | | | Since the `#file_name` that not consideration for the namespace, if generate a controller with a namespace, not the correct url helper generation, it had become an error to run the test. Modified to generate the correct url helper, even if it is produced a namespace with controller.
* Update test generators to use ActionDispatch::IntegrationTestAbdelkader Boudih2015-12-151-0/+12
| | | | | | | | | | | | In Rails 5.1 `ActionController::TestCase` will be moved out of Rails into it's own gem. Please use `ActionDispatch::IntegrationTest` going forward. This changes the generators to use `ActionDispatch::IntegrationTest` and the required URL setup (rather than symbols) for each of the controller actions. Updated fix to #22076.
* fix NoMethodError that occurs when generating scaffold inside full mode engineyuuji.yaginuma2015-06-281-0/+4
|
* [ci skip] Fix the Rails::Generators::NamedBase#template docRoque Pinel2015-06-151-2/+2
| | | | | Since #13612, `template` is no longer being used to generate migrations.
* respect `pluralize_table_names` when generate fixture file. fixes #19519yuuji.yaginuma2015-03-271-0/+4
|
* Fix description for application_name method - change simple to simplyPrathamesh Sonpatki2014-12-301-1/+1
| | | | [ci skip]
* Pass symbol as an argument instead of a blockErik Michaels-Ober2014-11-291-2/+2
|
* Add FIXME note about the thor bugRafael Mendonça França2014-05-241-0/+2
|
* Merge pull request #9083 from bronson/patch-1Rafael Mendonça França2014-05-241-1/+4
|\ | | | | | | avoid using alias in generators
| * avoid using alias in generatorsScott Bronson2013-01-251-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Ruby's alias produces public methods, causing a spurious Thor task to be created.  For example, this is the reason MigrationGenerator currently has two tasks:     > ActiveRecord::Generators::MigrationGenerator.all_tasks.keys     => ["singular_name", "create_migration_file"] singular_name was meant to be an attribute, not a task.  Because it's public, it gets called as a task every time the generator is invoked. The fix is to ensure all generator methods have the correct visibility.
* | avoiding iterations and calling of underscore on all elements of arrayAkshay Vishnoi2013-11-171-1/+1
| |
* | copy edits[ci skip]Vijay Dev2013-05-191-3/+1
| |
* | Added documentation for Rails::Generators::NamedBase.templateaditya-kapoor2013-05-141-0/+4
| |
* | add require to suppress warning; remove variableVipul A M2013-04-041-1/+1
| |
* | Add support for generate scaffold password:digestSam Ruby2013-03-131-0/+1
|/ | | | | | | | | | * adds password_digest attribute to the migration * adds has_secure_password to the model * adds password and password_confirmation password_fields to _form.html * omits password entirely from index.html and show.html * adds password and password_confirmation to the controller * adds unencrypted password and password_confirmation to the controller test * adds encrypted password_digest to the fixture
* Add GeneratedAttribute#column_name to get the name of the column in theRafael Mendonça França2012-12-101-1/+1
| | | | database
* Extract a attributes_names method to avoid duplicationRafael Mendonça França2012-12-101-0/+7
|
* Remove observers and sweepersRafael Mendonça França2012-11-281-2/+2
| | | | | | | | They was extracted from a plugin. See https://github.com/rails/rails-observers [Rafael Mendonça França + Steve Klabnik]
* Use Ruby 1.9 Hash syntax in railtiesRobin Dupret2012-10-141-4/+4
|
* reduce number of StringsAkira Matsuda2012-06-061-1/+1
|
* Make method name consistent with existing methodsAndrew White2012-06-061-3/+3
|
* Fixed the application_controller require_dependency path generated by the ↵Fred Wu2012-06-061-4/+5
| | | | app generator
* Fix generators to help with ambiguous `ApplicationController` issuePiotr Sarnacki2012-05-201-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In development mode, dependencies are loaded dynamically at runtime, using `const_missing`. Because of that, when one of the constants is already loaded and `const_missing` is not triggered, user can end up with unexpected results. Given such file in an Engine: ```ruby module Blog class PostsController < ApplicationController end end ``` If you load it first, before loading any application files, it will correctly load `Blog::ApplicationController`, because second line will hit `const_missing`. However if you load `ApplicationController` first, the constant will be loaded already, `const_missing` hook will not be fired and in result `PostsController` will inherit from `ApplicationController` instead of `Blog::ApplicationController`. Since it can't be fixed in `AS::Dependencies`, the easiest fix is to just explicitly load application controller. closes #6413
* Don't indent blank lines in named base generatorsAlexey Vakhov2012-04-251-1/+1
|
* Updated/changed useless tr/gsubsJurriaan Pruis2012-04-031-1/+1
|
* Remove key_value helper now that master is 1.9 only and we always useRafael Mendonça França2012-03-131-5/+0
| | | | the 1.9 hash syntax in the generators.
* Tidy up migration types.José Valim2011-12-241-1/+1
|
* added ability to specify from cli when generating a model/migration whether ↵Dmitrii Samoilov2011-12-241-3/+2
| | | | particular property should be an index like this 'rails g model person name:string:index profile:string'
* Get rid of more 1.8.x dead codeJosé Valim2011-12-201-7/+2
|
* Get rid of --old-style-hashJosé Valim2011-12-201-3/+0
|
* Use namespace if it's a mountable engineStefan Sprenger2011-06-071-3/+1
|
* initialize @inside_templateAkira Matsuda2011-05-181-0/+1
| | | | fixes: "warning: instance variable @inside_template not initialized"
* ADdd missing requires (thanks to @arunagw)José Valim2011-05-071-0/+1
|
* Add --old-style-hash option to force creating old style hash on Ruby 1.9Prem Sichanugrist2011-04-101-1/+4
| | | | That means if you don't like the new syntax, you can pass --old-style-hash to force Rails to generate code with hash rockets.
* Rails will now generate Ruby 1.9 style hash when running scaffold_controller ↵Prem Sichanugrist2011-04-101-0/+10
| | | | | | | | generator on Ruby 1.9.x The new hash syntax of Ruby 1.9 looks more superior, so we decide to switch to it in the places that appropriate. This patch has been requested by DHH.