mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
db5d26c9d7
It was causing error when using `with_options` passing a lambda as its
last argument.
class User < ActiveRecord::Base
with_options dependent: :destroy do |assoc|
assoc.has_many :profiles, -> { where(active: true) }
end
end
It was happening because the `option_merger` was taking the last
argument and checking if it was a Hash. This breaks the HasMany usage,
because its last argument can be a Hash or a Proc.
As the behavior described in this test:
https://github.com/rails/rails/blob/master/activesupport/test/option_merger_test.rb#L69
the method will only accept the lambda, this way it will keep the expected behavior. See
|
||
---|---|---|
.. | ||
cache | ||
concurrency | ||
core_ext | ||
dependencies | ||
deprecation | ||
inflector | ||
json | ||
locale | ||
log_subscriber | ||
multibyte | ||
notifications | ||
number_helper | ||
testing | ||
values | ||
xml_mini | ||
all.rb | ||
backtrace_cleaner.rb | ||
benchmarkable.rb | ||
builder.rb | ||
cache.rb | ||
callbacks.rb | ||
concern.rb | ||
configurable.rb | ||
core_ext.rb | ||
dependencies.rb | ||
deprecation.rb | ||
descendants_tracker.rb | ||
duration.rb | ||
file_update_checker.rb | ||
file_watcher.rb | ||
gem_version.rb | ||
gzip.rb | ||
hash_with_indifferent_access.rb | ||
i18n.rb | ||
i18n_railtie.rb | ||
inflections.rb | ||
inflector.rb | ||
json.rb | ||
key_generator.rb | ||
lazy_load_hooks.rb | ||
log_subscriber.rb | ||
logger.rb | ||
logger_silence.rb | ||
message_encryptor.rb | ||
message_verifier.rb | ||
multibyte.rb | ||
notifications.rb | ||
number_helper.rb | ||
option_merger.rb | ||
ordered_hash.rb | ||
ordered_options.rb | ||
per_thread_registry.rb | ||
proxy_object.rb | ||
rails.rb | ||
railtie.rb | ||
rescuable.rb | ||
string_inquirer.rb | ||
subscriber.rb | ||
tagged_logging.rb | ||
test_case.rb | ||
time.rb | ||
time_with_zone.rb | ||
version.rb | ||
xml_mini.rb |