1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Remove deprecated required option on the model generators

This commit is contained in:
Rafael Mendonça França 2020-10-29 21:21:08 +00:00
parent 8992a7d0c2
commit 3c18a0cca8
No known key found for this signature in database
GPG key ID: FC23B6D0F1EEE948
2 changed files with 0 additions and 18 deletions

View file

@ -1,7 +1,6 @@
# frozen_string_literal: true
require "active_support/time"
require "active_support/deprecation"
module Rails
module Generators
@ -52,11 +51,6 @@ module Rails
provided_options = $2.split(/[,.-]/)
options = Hash[provided_options.map { |opt| [opt.to_sym, true] }]
if options[:required]
ActiveSupport::Deprecation.warn("Passing {required} option has no effect on the model generator. It will be removed in Rails 6.1.\n")
options.delete(:required)
end
return type, options
else
return type, {}

View file

@ -480,18 +480,6 @@ class ModelGeneratorTest < Rails::Generators::TestCase
assert_file "app/models/account.rb", expected_file
end
def test_passing_required_to_model_generator_is_deprecated
assert_deprecated do
run_generator ["account", "supplier:references{required}"]
end
assert_migration "db/migrate/create_accounts.rb" do |m|
assert_method :change, m do |up|
assert_match(/t\.references :supplier,.*\snull: false/, up)
end
end
end
def test_null_false_is_added_for_references_by_default
run_generator ["account", "user:references"]