| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
| |
Move from `AS::Callbacks::CallbackChain.halt_and_display_warning_on_return_false`
to `AS::Callbacks.halt_and_display_warning_on_return_false` base on
[this
discussion](https://github.com/rails/rails/pull/21218#discussion_r39354580)
Fix the documentation broken by 0a120a818d413c64ff9867125f0b03788fc306f8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
With this we can perform new assertions on the returned value without having
to cache it with an outer variable or wrapping all subsequent assertions inside
the `assert_difference` block.
Before:
```
post = nil
assert_difference -> { Post.count }, 1 do
Post.create
end
assert_predicate post, :persisted?
```
Now:
```
post = assert_difference -> { Post.count } do
Post.create
end
assert_predicate post, :persisted?
```
|
|
|
|
|
|
| |
Rails 4.2.3 AS::Callbacks will not halt chain if `false` is returned.
That is the behavior of specific callbacks like AR::Callbacks and
AM::Callbacks.
|
|
|
|
|
|
|
| |
The concept of a blank date or time doesn't make sense so we can short
circuit the calls for `blank?` on these classes to gain small speed boost.
Fixes #21657
|
|
|
|
|
|
|
| |
The thread_safe gem is being deprecated and all its code has been merged
into the concurrent-ruby gem. The new class, Concurrent::Map, is exactly
the same as its predecessor except for fixes to two bugs discovered
during the merge.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
The problem existed where if your ArrayInquirer values were
strings but you checked them using any? with a symbol, it would
not find the value. Now it will correctly check whether both
the String form or the Symbol form are included in the Array.
`
|
|
|
|
|
|
|
|
|
|
| |
user passed `options[:delimited_regex]` if available. Changed `DELIMITED_REGEX` to `DEFAULT)DELIMITED_REGEX` to signify what it means.
- Added tests for number to delimited and number to currency in both actionview and activesupport.
Changes
Changes
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
```ruby
twz = DateTime.now.in_time_zone
twz.eql?(twz.dup) => false
```
Now:
```ruby
twz = DateTime.now.in_time_zone
twz.eql?(twz.dup) => true
```
Please notice that this fix the `TimeWithZone` comparison to itself,
not to `DateTime`. Based on #3725, `DateTime` should not be equal to
`TimeWithZone`.
|
|
|
|
| |
enumerator if called without block
|
|
|
|
|
|
|
|
|
|
| |
The concurrent-ruby gem is a toolset containing many concurrency
utilities. Many of these utilities include runtime-specific
optimizations when possible. Rather than clutter the Rails codebase with
concurrency utilities separate from the core task, such tools can be
superseded by similar tools in the more specialized gem. This commit
replaces `ActiveSupport::Concurrency::Latch` with
`Concurrent::CountDownLatch`, which is functionally equivalent.
|
| |
|
| |
|
| |
|
|
|
| |
:nail: remove extraneous bracket
|
|
|
|
|
| |
Passing 999999000 < `:nsec` < 999999999 and 999999 < `:usec` < 1000000
to change a time with utc_offset doesn't throw an `ArgumentError`.
|
|
|
|
| |
Allows fetching the same values from arrays as from ActiveRecord associations.
|
|\
| |
| |
| | |
Add bang version to OrderedOptions
|
| |
| |
| |
| |
| |
| | |
By:
Aditya Sanghi(@asanghi)
Gaurish Sharma(gaurish)
|
|\ \
| |/
|/|
| | |
Remove `.superclass_delegating_accessor`.
|
|/ |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
`Delegator` inherits from `BasicObject`, which means that it will not
have `Object#try` defined. It will then delegate the call to the
underlying object, which will not (necessarily) respond to the method
defined in the enclosing `Delegator`.
This patches `Delegator` with the `#try` method to work around the
surprising behaviour.
Fixes #5790
|
| |
|
| |
|
|
|
|
| |
Fixnum#zero?
|
|
|
|
|
|
|
|
|
|
|
| |
Previously when converting AS::TimeWithZone to YAML it would be output
as a UTC timestamp. Whilst this preserves the time information accurately
it loses the timezone information. This commit changes that so that it is
saved along with the time information. It also provides nicer encoding of
AS::TimeZone instances themselves which previously embedded all of the
data from the TZInfo records.
Fixes #9183.
|
|
|
|
| |
This makes it easier to parse user-inputted times as from a given time zone.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
At present, if you skip a callback that hasn't been defined,
activesupport callbacks silently does nothing. However, it's easy to
mistype the name of a callback and mistakenly think that it's being
skipped, when it is not.
This problem even exists in the current test suite.
CallbacksTest::SkipCallbacksTest#test_skip_person attempts to skip
callbacks that were never set up.
This PR changes `skip_callback` to raise an `ArgumentError` if the
specified callback cannot be found.
|
|
|
|
|
|
| |
This reverts commit 9420de59f5b7f5ceac77e28e6c326ec145f71f80.
Reason: Turns out we want to keep this method.
|
|
|
|
|
| |
We are promoting too much a feature that will not be widler used.
So for now lets keep just the ArrayInquirer constructor.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Wrapping an array in an `ArrayInquirer` gives a friendlier way to check its
string-like contents. For example, `request.variant` returns an `ArrayInquirer`
object. To check a request's variants, you can call:
request.variant.phone?
request.variant.any?(:phone, :tablet)
...instead of:
request.variant.include?(:phone)
request.variant.any? { |v| v.in?([:phone, :tablet]) }
`Array#inquiry` is a shortcut for wrapping the receiving array in an
`ArrayInquirer`:
pets = [:cat, :dog]
pets.cat? # => true
pets.ferret? # => false
pets.any?(:cat, :ferret} # => true
|
|
|
| |
…as discussed #19413
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Reverting this as it's not the implementation that we would like it to be.
This is being used inside of ActiveSUpport::TimeZone[] and it's unaware
of the context in which to find the timezone period so the timezone found
changes depending on whether DST is in effect for the current period.
This means that `'2001-01-01'.in_time_zone(-9)` changes from winter/summer
even though it's the same date that we're trying to convert.
Since finding timezones by numeric offsets is a bit hit and miss we should
introduce a new API for finding them which supplies the date context in
which we want to search and we should probably also deprecate the finding
of timezones via the [] method, though this needs further discussion.
This reverts commit 2cc2fa3633edd96773023c6b09d07c7b9d9b841d.
|
|
|
|
| |
This entry now lives in the Action View's changelog ; refs 8a3bd089.
|
|
|
|
| |
Closes #19227.
|
|
|
|
|
|
| |
When given a specific offset, use the first result found where the
total current offset (including any periodic deviations such as DST)
from UTC is equal.
|
| |
|
|
|
|
| |
Fixes #19070.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`coder.represent_scalar` means something along the lines of "Here is a quoted
string, you can just add it to the output", which is not the case here. It only
works for simple strings that can appear unquoted in YAML, but causes problems
for e.g. primitive-like strings ("1", "true").
`coder.represent_object` on the other hand, means that "This is the Ruby-object
representation for this thing suitable for use in YAML dumping", which is what
we want here.
Before:
YAML.load ActiveSupport::SafeBuffer.new("Hello").to_yaml # => "Hello"
YAML.load ActiveSupport::SafeBuffer.new("true").to_yaml # => true
YAML.load ActiveSupport::SafeBuffer.new("false").to_yaml # => false
YAML.load ActiveSupport::SafeBuffer.new("1").to_yaml # => 1
YAML.load ActiveSupport::SafeBuffer.new("1.1").to_yaml # => 1.1
After:
YAML.load ActiveSupport::SafeBuffer.new("Hello").to_yaml # => "Hello"
YAML.load ActiveSupport::SafeBuffer.new("true").to_yaml # => "true"
YAML.load ActiveSupport::SafeBuffer.new("false").to_yaml # => "false"
YAML.load ActiveSupport::SafeBuffer.new("1").to_yaml # => "1"
YAML.load ActiveSupport::SafeBuffer.new("1.1").to_yaml # => "1.1"
If we ever want Ruby to behave more like PHP or JavaScript though, this is an
excellent trick to use ;)
|
|\
| |
| |
| |
| |
| |
| |
| |
| | |
Enable number_to_percentage to keep the number's precision by allowing :precision option value to be nil
Conflicts:
activesupport/CHANGELOG.md
activesupport/lib/active_support/number_helper.rb
activesupport/test/number_helper_test.rb
|
| |
| |
| |
| |
| |
| | |
:precision to be nil
number_helper.number_to_percentage(1000, precision: nil) # => "1000%"
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| | |
It's a thin layer to provide easy access to sample files throughout
test-cases. This adds the directory `test/fixtures/files` to newly
generated applications.
|
| |
| |
| |
| | |
Return value of yielded block in File.atomic_write
|