railties 7.1.0.beta1 → 7.1.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f6bd5ef3fd826daba56de7c93ff5b7ca0481090c6699f69a86493c32878e3bb1
4
- data.tar.gz: a2605e31ee7524c2aae5fb88f89201f22e97219fcb42f391a359a60cd1b667c3
3
+ metadata.gz: 3416ad21bc1fea96fde2559809ea0a6308235550c8a2c6eba98bce7fa80d8593
4
+ data.tar.gz: 79563508482421776e153045f0070f94b3707ff209be5495da350c9f4ece9bbc
5
5
  SHA512:
6
- metadata.gz: 03b9cbaa154995862acc1d1e6f2cdcf1780fea3ddb9e3f0af8586b0d4698d08869e517d2d2f61057dd316e1cc723759da66de1ae6a8d01dfff30edd8c824711d
7
- data.tar.gz: 59ccbc1582559ddc5baff3ea789bbf8e56a463100ed2d8858b852eaeb4feeb6cb0c178d4bf2e2abafce0b1e2b8145756a068d32996fd3e71ab992facb4ad646f
6
+ metadata.gz: ac25e791cb1d7209726a566fbb687287ca55a4ac6b1f9e87cc8234986798cd8efa0ac3678fa2d5d9adcc4c8f2a280ce9eaeeebb34f714eecbf9c8311378b0b27
7
+ data.tar.gz: 00afe64975a58ba819c91b562da2d710216ec160e48ff05bc281c2f87dabcf4bac422020d1d356791b9cff030a0027ba7098880f7b4b5b4f7963ad775d73bcc8
data/CHANGELOG.md CHANGED
@@ -1,9 +1,41 @@
1
+ ## Rails 7.1.0.rc1 (September 27, 2023) ##
2
+
3
+ * Require `concurrent-ruby` in `config/puma.rb` so that Puma can boot in
4
+ production when `WEB_CONCURRENCY` is not explicitly specified.
5
+
6
+ Fixes #49323.
7
+
8
+ *Matt Brictson*
9
+
10
+ * Raise error when generating attribute with dangerous name.
11
+
12
+ The following will now raise an error as `save` and `hash` are already
13
+ defined by Active Record.
14
+
15
+ ```bash
16
+ $ bin/rails generate model Post save
17
+ $ bin/rails generate model Post hash
18
+ ```
19
+
20
+ *Petrik de Heus*
21
+
22
+
1
23
  ## Rails 7.1.0.beta1 (September 13, 2023) ##
2
24
 
25
+ * Add ability to show slow tests to the test runner
26
+
27
+ ```bash
28
+ $ bin/test --profile # additionally prints 10 (default) slowest tests
29
+ # or
30
+ $ bin/test --profile 20 # prints 20 slowest tests
31
+ ```
32
+
33
+ *fatkodima*
34
+
3
35
  * `rails new --javascript` generator now supports Bun
4
36
 
5
37
  ```bash
6
- rails new my_new_app --javascript=bun
38
+ $ rails new my_new_app --javascript=bun
7
39
  ```
8
40
 
9
41
  *Jason Meller*
@@ -80,7 +80,7 @@ module Rails
80
80
  console.level = Rails.logger.level
81
81
 
82
82
  unless ActiveSupport::Logger.logger_outputs_to?(Rails.logger, STDERR, STDOUT)
83
- Rails.logger.extend(ActiveSupport::Logger.broadcast(console))
83
+ Rails.logger = ActiveSupport::BroadcastLogger.new(Rails.logger, console)
84
84
  end
85
85
  end
86
86
 
@@ -10,7 +10,7 @@ module Rails
10
10
  MAJOR = 7
11
11
  MINOR = 1
12
12
  TINY = 0
13
- PRE = "beta1"
13
+ PRE = "rc1"
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
@@ -497,7 +497,7 @@ module Rails
497
497
  end
498
498
 
499
499
  def dockerfile_bun_version
500
- using_bun? and "bun-v#{`bun --version`[/\d+\.\d+\.\d+/]}"
500
+ using_bun? and `bun --version`[/\d+\.\d+\.\d+/]
501
501
  rescue
502
502
  BUN_VERSION
503
503
  end
@@ -27,6 +27,26 @@ module Rails
27
27
  end
28
28
  end
29
29
 
30
+ def docker_for_database_build(database = options[:database])
31
+ case database
32
+ when "mysql" then "build-essential default-libmysqlclient-dev git"
33
+ when "trilogy" then "build-essential default-libmysqlclient-dev git"
34
+ when "postgresql" then "build-essential git libpq-dev"
35
+ when "sqlite3" then "build-essential git"
36
+ else nil
37
+ end
38
+ end
39
+
40
+ def docker_for_database_deploy(database = options[:database])
41
+ case database
42
+ when "mysql" then "curl default-mysql-client libvips"
43
+ when "trilogy" then "curl default-mysql-client libvips"
44
+ when "postgresql" then "curl libvips postgresql-client"
45
+ when "sqlite3" then "curl libsqlite3-0 libvips"
46
+ else nil
47
+ end
48
+ end
49
+
30
50
  def convert_database_option_for_jruby
31
51
  if defined?(JRUBY_VERSION)
32
52
  opt = options.dup
@@ -43,6 +43,10 @@ module Rails
43
43
  type, attr_options = *parse_type_and_options(type)
44
44
  type = type.to_sym if type
45
45
 
46
+ if dangerous_name?(name)
47
+ raise Error, "Could not generate field '#{name}', as it is already defined by Active Record."
48
+ end
49
+
46
50
  if type && !valid_type?(type)
47
51
  raise Error, "Could not generate field '#{name}' with unknown type '#{type}'."
48
52
  end
@@ -60,8 +64,14 @@ module Rails
60
64
  new(name, type, index_type, attr_options)
61
65
  end
62
66
 
67
+ def dangerous_name?(name)
68
+ defined?(ActiveRecord::Base) &&
69
+ ActiveRecord::Base.dangerous_attribute_method?(name)
70
+ end
71
+
63
72
  def valid_type?(type)
64
73
  DEFAULT_TYPES.include?(type.to_s) ||
74
+ !defined?(ActiveRecord::Base) ||
65
75
  ActiveRecord::Base.connection.valid_type?(type)
66
76
  end
67
77
 
@@ -9,11 +9,18 @@ Description:
9
9
  Note that the arguments specified in the .railsrc file don't affect the
10
10
  default values shown above in this help message.
11
11
 
12
+ You can specify which version to use when creating a new rails application
13
+ using `rails _<version>_ new`.
14
+
12
15
  Examples:
13
16
  `rails new ~/Code/Ruby/weblog`
14
17
 
15
18
  This generates a new Rails app in ~/Code/Ruby/weblog.
16
19
 
20
+ `rails _<version>_ new weblog`
21
+
22
+ This generates a new Rails app with the provided version in ./weblog.
23
+
17
24
  `rails new weblog --api`
18
25
 
19
26
  This generates a new Rails app in API mode in ./weblog.
@@ -32,21 +32,18 @@ RUN curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz
32
32
  rm -rf /tmp/node-build-master
33
33
 
34
34
  <% end -%>
35
-
36
35
  <% if using_bun? -%>
37
36
  ENV BUN_INSTALL=/usr/local/bun
38
37
  ENV PATH=/usr/local/bun/bin:$PATH
39
38
  ARG BUN_VERSION=<%= dockerfile_bun_version %>
40
- RUN curl -fsSL https://bun.sh/install | bash -s -- "${BUN_VERSION}"
39
+ RUN curl -fsSL https://bun.sh/install | bash -s -- "bun-v${BUN_VERSION}"
41
40
 
42
41
  <% end -%>
43
-
44
42
  # Install application gems
45
43
  COPY Gemfile Gemfile.lock ./
46
44
  RUN bundle install && \
47
45
  rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git<% if depend_on_bootsnap? -%> && \
48
- bundle exec bootsnap precompile --gemfile
49
- <% end %>
46
+ bundle exec bootsnap precompile --gemfile<% end %>
50
47
 
51
48
  <% if using_node? -%>
52
49
  # Install node modules
@@ -54,7 +51,6 @@ COPY package.json yarn.lock ./
54
51
  RUN yarn install --frozen-lockfile
55
52
 
56
53
  <% end -%>
57
-
58
54
  <% if using_bun? -%>
59
55
  # Install node modules
60
56
  COPY package.json bun.lockb ./
@@ -63,6 +63,6 @@ group :test do
63
63
  gem "selenium-webdriver"
64
64
  <%- if RUBY_VERSION < "3.0" -%>
65
65
  gem "webdrivers"
66
- <% end %>
66
+ <%- end -%>
67
67
  end
68
68
  <%- end -%>
@@ -15,7 +15,9 @@ module <%= app_const_base %>
15
15
  config.load_defaults Rails::VERSION::STRING.to_f
16
16
  <%- end -%>
17
17
 
18
- # Please, see https://guides.rubyonrails.org/autoloading_and_reloading_constants.html#config-autoload-lib-ignore.
18
+ # Please, add to the `ignore` list any other `lib` subdirectories that do
19
+ # not contain `.rb` files, or that should not be reloaded or eager loaded.
20
+ # Common ones are `templates`, `generators`, or `middleware`, for example.
19
21
  config.autoload_lib(ignore: %w(assets tasks))
20
22
 
21
23
  # Configuration for the application, engines, and railties goes here.
@@ -1,8 +1,8 @@
1
1
  # Be sure to restart your server when you modify this file.
2
2
 
3
- # Configure parameters to be filtered from the log file. Use this to limit dissemination of
4
- # sensitive information. See the ActiveSupport::ParameterFilter documentation for supported
5
- # notations and behaviors.
3
+ # Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.
4
+ # Use this to limit dissemination of sensitive information.
5
+ # See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
6
6
  Rails.application.config.filter_parameters += [
7
7
  :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
8
8
  ]
@@ -11,7 +11,7 @@
11
11
 
12
12
  # No longer add autoloaded paths into `$LOAD_PATH`. This means that you won't be able
13
13
  # to manually require files that are managed by the autoloader, which you shouldn't do anyway.
14
- # This reduce the size of the load path, making `require` faster if you don't use bootsnap, or reduce the size
14
+ # This will reduce the size of the load path, making `require` faster if you don't use bootsnap, or reduce the size
15
15
  # of the bootsnap cache if you use it.
16
16
  # Rails.application.config.add_autoload_paths_to_load_path = false
17
17
 
@@ -13,6 +13,7 @@ threads min_threads_count, max_threads_count
13
13
 
14
14
  # Specifies that the worker count should equal the number of processors in production.
15
15
  if ENV["RAILS_ENV"] == "production"
16
+ require "concurrent-ruby"
16
17
  worker_count = Integer(ENV.fetch("WEB_CONCURRENCY") { Concurrent.physical_processor_count })
17
18
  workers worker_count if worker_count > 1
18
19
  end
@@ -6,5 +6,5 @@ Rails.application.routes.draw do
6
6
  get "up" => "rails/health#show", as: :rails_health_check
7
7
 
8
8
  # Defines the root path route ("/")
9
- # root "articles#index"
9
+ # root "posts#index"
10
10
  end
@@ -6,14 +6,14 @@
6
6
  # Ignore bundler config.
7
7
  /.bundle
8
8
 
9
+ # Ignore all environment files (except templates).
10
+ /.env*
11
+ !/.env*.erb
12
+
9
13
  # Ignore all default key files.
10
14
  /config/master.key
11
15
  /config/credentials/*.key
12
16
 
13
- # Ignore all environment files.
14
- /.env*
15
- !/.env.example
16
-
17
17
  # Ignore all logfiles and tempfiles.
18
18
  /log/*
19
19
  /tmp/*
@@ -7,6 +7,10 @@
7
7
  # Ignore bundler config.
8
8
  /.bundle
9
9
 
10
+ # Ignore all environment files (except templates).
11
+ /.env*
12
+ !/.env*.erb
13
+
10
14
  # Ignore all logfiles and tempfiles.
11
15
  /log/*
12
16
  /tmp/*
@@ -40,16 +40,43 @@ module Rails
40
40
  gsub_file("Gemfile", gem_entry_regex_for(name), gem_entry_for(name, *version))
41
41
  end
42
42
 
43
+ def edit_dockerfile
44
+ build_name = docker_for_database_build
45
+ deploy_name = docker_for_database_deploy
46
+ if build_name
47
+ gsub_file("Dockerfile", all_docker_builds_regex, build_name)
48
+ end
49
+ if deploy_name
50
+ gsub_file("Dockerfile", all_docker_deploys_regex, deploy_name)
51
+ end
52
+ end
53
+
43
54
  private
44
55
  def all_database_gems
45
56
  DATABASES.map { |database| gem_for_database(database) }
46
57
  end
47
58
 
59
+ def all_docker_builds
60
+ DATABASES.map { |database| docker_for_database_build(database).nil? ? nil : docker_for_database_build(database) }.compact!
61
+ end
62
+
63
+ def all_docker_deploys
64
+ DATABASES.map { |database| docker_for_database_deploy(database).nil? ? nil : docker_for_database_deploy(database) }.compact!
65
+ end
66
+
48
67
  def all_database_gems_regex
49
68
  all_database_gem_names = all_database_gems.map(&:first)
50
69
  /(\b#{all_database_gem_names.join('\b|\b')}\b)/
51
70
  end
52
71
 
72
+ def all_docker_builds_regex
73
+ /(\b#{all_docker_builds.join('\b|\b')}\b)/
74
+ end
75
+
76
+ def all_docker_deploys_regex
77
+ /(\b#{all_docker_deploys.join('\b|\b')}\b)/
78
+ end
79
+
53
80
  def gem_entry_regex_for(gem_name)
54
81
  /^gem.*\b#{gem_name}\b.*/
55
82
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: railties
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.1.0.beta1
4
+ version: 7.1.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-09-13 00:00:00.000000000 Z
11
+ date: 2023-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 7.1.0.beta1
19
+ version: 7.1.0.rc1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 7.1.0.beta1
26
+ version: 7.1.0.rc1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: actionpack
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 7.1.0.beta1
33
+ version: 7.1.0.rc1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 7.1.0.beta1
40
+ version: 7.1.0.rc1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rackup
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -120,14 +120,14 @@ dependencies:
120
120
  requirements:
121
121
  - - '='
122
122
  - !ruby/object:Gem::Version
123
- version: 7.1.0.beta1
123
+ version: 7.1.0.rc1
124
124
  type: :development
125
125
  prerelease: false
126
126
  version_requirements: !ruby/object:Gem::Requirement
127
127
  requirements:
128
128
  - - '='
129
129
  - !ruby/object:Gem::Version
130
- version: 7.1.0.beta1
130
+ version: 7.1.0.rc1
131
131
  description: 'Rails internals: application bootup, plugins, generators, and rake tasks.'
132
132
  email: david@loudthinking.com
133
133
  executables:
@@ -457,10 +457,10 @@ licenses:
457
457
  - MIT
458
458
  metadata:
459
459
  bug_tracker_uri: https://github.com/rails/rails/issues
460
- changelog_uri: https://github.com/rails/rails/blob/v7.1.0.beta1/railties/CHANGELOG.md
461
- documentation_uri: https://api.rubyonrails.org/v7.1.0.beta1/
460
+ changelog_uri: https://github.com/rails/rails/blob/v7.1.0.rc1/railties/CHANGELOG.md
461
+ documentation_uri: https://api.rubyonrails.org/v7.1.0.rc1/
462
462
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
463
- source_code_uri: https://github.com/rails/rails/tree/v7.1.0.beta1/railties
463
+ source_code_uri: https://github.com/rails/rails/tree/v7.1.0.rc1/railties
464
464
  rubygems_mfa_required: 'true'
465
465
  post_install_message:
466
466
  rdoc_options: