diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-04-05 14:48:49 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-04-05 14:48:49 -0700 |
commit | 01034d3be0d7c8c09b551ac612c4b18f86086dc5 (patch) | |
tree | 3d5d590d6459f2f3a9ad0b15f08169babcce428c /railties/lib/rails | |
parent | c037659294555298889a7102c580240804f44d84 (diff) | |
parent | 096ee1594d329f53ef47d0aff9bb6eef25a18b96 (diff) | |
download | rails-01034d3be0d7c8c09b551ac612c4b18f86086dc5.tar.gz rails-01034d3be0d7c8c09b551ac612c4b18f86086dc5.tar.bz2 rails-01034d3be0d7c8c09b551ac612c4b18f86086dc5.zip |
Merge branch 'master' into railstest
* master: (44 commits)
Improve the changelog entry [ci skip]
Fix explicit names on multiple file fields
Correctly parse bigint defaults in PostgreSQL
Move changelog to the top [ci skip]
Fix indent and remove extra white spaces
Fix scope chaining + STI
failing test for #9869
Improve `belongs_to touch: true` timestamp test
Sort modules in alphabetical order.
Avoid an attempt to fetch old record when id was not present in touch callback
Use the correct pk field from the reflected class to find the old record
Refactor mail_to to not generate intermediate hashes when adding href
Ensure mail_to helper does not modify the given html options hash
Use inspect when writing the foreign key from the reflection
Use a space after the comment sign when showing the result of commands
Exclude template files for rdoc API [ci skip]
template should have generic name
use | to have more intent revealing code
Revert "Merge pull request #10034 from benofsky/fix_skipping_object_callback_filters"
stop depending on callbacks
...
Conflicts:
railties/test/application/rake_test.rb
Diffstat (limited to 'railties/lib/rails')
-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] } |