diff options
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/api/task.rb | 3 | ||||
-rw-r--r-- | railties/lib/rails/generators/named_base.rb | 2 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/model/USAGE | 26 | ||||
-rw-r--r-- | railties/lib/rails/test_unit/testing.rake | 4 |
4 files changed, 23 insertions, 12 deletions
diff --git a/railties/lib/rails/api/task.rb b/railties/lib/rails/api/task.rb index 1e6458cf93..c829873da4 100644 --- a/railties/lib/rails/api/task.rb +++ b/railties/lib/rails/api/task.rb @@ -57,7 +57,8 @@ module Rails CHANGELOG.md MIT-LICENSE lib/**/*.rb - ) + ), + :exclude => 'lib/rails/generators/rails/**/templates/**/*.rb' } } diff --git a/railties/lib/rails/generators/named_base.rb b/railties/lib/rails/generators/named_base.rb index 8b4f52bb3b..d891ba1215 100644 --- a/railties/lib/rails/generators/named_base.rb +++ b/railties/lib/rails/generators/named_base.rb @@ -40,7 +40,7 @@ module Rails def indent(content, multiplier = 2) spaces = " " * multiplier - content = content.each_line.map {|line| line.blank? ? line : "#{spaces}#{line}" }.join + content.each_line.map {|line| line.blank? ? line : "#{spaces}#{line}" }.join end def wrap_with_namespace(content) diff --git a/railties/lib/rails/generators/rails/model/USAGE b/railties/lib/rails/generators/rails/model/USAGE index 6574200fbf..1998a392aa 100644 --- a/railties/lib/rails/generators/rails/model/USAGE +++ b/railties/lib/rails/generators/rails/model/USAGE @@ -52,20 +52,26 @@ Available field types: `rails generate model product supplier:references{polymorphic}` - You can also specify some options just after the field type. You can use the - following options: + For integer, string, text and binary fields an integer in curly braces will + be set as the limit: - limit Set the maximum size of the field giving a number between curly braces - default Set a default value for the field - precision Defines the precision for the decimal fields - scale Defines the scale for the decimal fields - uniq Defines the field values as unique - index Will add an index on the field + `rails generate model user pseudo:string{30}` - Examples: + For decimal two integers separated by a comma in curly braces will be used + for precision and scale: + + `rails generate model product price:decimal{10,2}` + + You can add a `:uniq` or `:index` suffix for unique or standard indexes + respectively: - `rails generate model user pseudo:string{30}` `rails generate model user pseudo:string:uniq` + `rails generate model user pseudo:string:index` + + You can combine any single curly brace option with the index options: + + `rails generate model user username:string{30}:uniq` + `rails generate model product supplier:references{polymorphic}:index` Examples: diff --git a/railties/lib/rails/test_unit/testing.rake b/railties/lib/rails/test_unit/testing.rake index 4f55f2f866..07d2c192e4 100644 --- a/railties/lib/rails/test_unit/testing.rake +++ b/railties/lib/rails/test_unit/testing.rake @@ -78,6 +78,8 @@ namespace :test do end Rails::TestTask.new(recent: "test:prepare") do |t| + warn "DEPRECATION WARNING: `rake test:recent` is deprecated" + since = TEST_CHANGES_SINCE touched = FileList['test/**/*_test.rb'].select { |path| File.mtime(path) > since } + recent_tests('app/models/**/*.rb', 'test/models', since) + @@ -90,6 +92,8 @@ namespace :test do Rake::Task['test:recent'].comment = "Test recent changes" Rails::TestTask.new(uncommitted: "test:prepare") do |t| + warn "DEPRECATION WARNING: `rake test:uncommitted` is deprecated" + def t.file_list if File.directory?(".svn") changed_since_checkin = silence_stderr { `svn status` }.split.map { |path| path.chomp[7 .. -1] } |