| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| | |
Refactor Date/Time next_occurring and prev_occurring
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
These methods were originally added in https://github.com/rails/rails/pull/26600
This includes a couple of refactors to make these methods behave more similarly to other Date/Time extensions added by Active Support:
1. Use `advance` instead of `since` and `ago` to time-travel — this is particularly important to keep the returned instance’s class matching `self`. Before this change:
today = Date.today # => Tue, 28 Nov 2017
today.class # => Date
today.next_occurring(:wednesday) # => Wed, 29 Nov 2017 00:00:00 UTC +00:00
today.next_occurring(:wednesday).class # => ActiveSupport::TimeWithZone
After this change, a Date (or Time, or DateTime) instance is properly returned (just like is shown in the new docs). This is generally how everything else in DateAndTime::Calculations works.
2. Move the tests from the DateTime tests to the DateAndTimeBehavior tests. The latter location is mixed in to the core_ext tests for _all_ of Date, Time, and DateTime to test the behavior across all of the classes. The previous location is for testing core_ext functionality added specifically just to DateTime.
3. Better docs!
|
|\ \
| |/
|/| |
Formatting fix for example code
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Just cleaning up the formatting of the example code here to format an inline bit of commentary as a comment.
Before:

After:

[ci skip]
|
|\
| |
| |
| | |
Scoping reserved names
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Due to inconsistent behavior when chaining scopes and one scope named after a Relation method
Validation code added in 2 places:
- scope, to prevent problematic scope names.
- enum, cause it tries to auto define scope.
|
|\ \
| | |
| | | |
[ci skip]Update docs `ActiveRecord::FinderMethods#find`
|
| | |
| | |
| | |
| | | |
ref https://github.com/rails/rails/pull/22653
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Action Mailer context for example responds to request but don't have a
a request object.
Fixes #31265
|
| | | |
|
|\ \ \
| | | |
| | | | |
Fix typos and add a few suggestions
|
|/ / / |
|
|\ \ \
| |_|/
|/| |
| | |
| | | |
rails/fix-relative-url-root-with-optimized-url-helpers
Fix optimized url helpers when using relative url root
|
| |/
| |
| |
| | |
Fixes #31220.
|
|\ \
| |/
|/| |
[ci skip] Update MVC wiki link
|
|/ |
|
|
|
|
| |
Follow up of 924a368f5c654f5304e575c767eb0fc64adc8659
|
|\
| |
| | |
Include migration files in gem
|
| |
| |
| |
| | |
Fixes #31245
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There are two concerns which are both being combined into one here, but
both have the same goal. There are certain attributes which we want to
always consider initialized. Previously, they were handled separately.
The primary key (which is assumed to be backed by a database column)
needs to be initialized, because there is a ton of code in Active Record
that assumes `foo.id` will never raise. Additionally, we want attributes
which aren't backed by a database column to always be initialized, since
we would never receive a database value for them.
Ultimately these two concerns can be combined into one. The old
implementation hid a lot of inherent complexity, and is hard to optimize
from the outside. We can simplify things significantly by just passing
in a hash.
This has slightly different semantics from the old behavior, in that
`Foo.select(:bar).first.id` will return the default value for the
primary key, rather than `nil` unconditionally -- however, the default
value is always `nil` in practice.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since #31173, mysql2 adapter depends on `automatic_close` which is
introduced since mysql2 0.4.3. So the adapter with the mysql2 version
before doesn't work with fork now.
```
% ARCONN=mysql2 be ruby -w -Itest test/cases/connection_adapters/connection_handler_test.rb -n test_forked_child_doesnt_mangle_parent_connection
Using mysql2
Run options: -n test_forked_child_doesnt_mangle_parent_connection --seed 19988
/Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb:108:in `discard!': undefined method `automatic_close=' for #<Mysql2::Client:0x00007fedaa91dfd0> (NoMethodError)
```
This drops mysql2 version less than 0.4.3 to guarantee fork safety.
|
|\
| |
| | |
[ci skip] Fix documentation for deprecation method_wrappers
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Seems like version with class methods doesn't work.
```ruby
require "active_support/deprecation.rb"
module Fred
extend self
def aaa; end
def bbb; end
def ccc; end
def ddd; end
def eee; end
end
ActiveSupport::Deprecation.deprecate_methods(Fred, :aaa, bbb: :zzz, ccc: 'use Bar#ccc instead')
Fred.aaa
Fred.bbb
Fred.ccc
```
# produces nothing
vs
```ruby
require "active_support/deprecation.rb"
class Fred
def aaa; end
def bbb; end
def ccc; end
def ddd; end
def eee; end
end
ActiveSupport::Deprecation.deprecate_methods(Fred, :aaa, bbb: :zzz, ccc: 'use Bar#ccc instead')
Fred.new.aaa
Fred.new.bbb
Fred.new.ccc
```
produces
```
DEPRECATION WARNING: aaa is deprecated and will be removed from Rails 5.2 (called from <main> at deprications.rb:15)
DEPRECATION WARNING: bbb is deprecated and will be removed from Rails 5.2 (use zzz instead) (called from <main> at deprications.rb:16)
DEPRECATION WARNING: ccc is deprecated and will be removed from Rails 5.2 (use Bar#ccc instead) (called from <main> at deprications.rb:17)
```
|
| | |
|
| | |
|
|\ \
| |/
|/| |
Update Rails on Rack guide [ci skip]
|
| | |
|
| | |
|
|\ \
| | |
| | | |
Added first draft of Rails 5.2 release notes [ci skip]
|
| | | |
|
| | | |
|
| | |
| | |
| | |
| | |
| | | |
This will keep the behavior of an application with the defaults of a 4.2
or 5.0 application behaving the same when upgrading to 5.2.
|
| | |
| | |
| | |
| | |
| | |
| | | |
Since `ContentSecurityPolicy::Middleware` is not loaded in API-only
Applications, initializer is unnecessary.
Ref: https://github.com/rails/rails/blob/9c10fec4c06da38f8975dfb851f4d899aa85f8b7/railties/lib/rails/application/default_middleware_stack.rb#L66..L68
|
| | | |
|
|\ \ \
| | | |
| | | | |
Added missing test for presence of CSP initializer
|
| |/ /
| | |
| | |
| | | |
- Followup of #31162
|
|\ \ \
| |/ /
|/| | |
Fix CHANGELOG for CSP PR #31162 [ci skip]
|
|/ / |
|
| | |
|
|\ \
| | |
| | | |
Add DSL for configuring Content-Security-Policy header
|
| | |
| | |
| | |
| | | |
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
|
|/ /
| |
| |
| |
| |
| |
| | |
The def with blank `()` was newly added in #31176, but we have not used
the blank `()` style in most part of our code base.
So I've enabled `Style/DefWithParentheses` to prevent to newly added the
code.
|
|\ \
| | |
| | | |
Use Puma 3.11 in newly generated applications
|
|/ /
| |
| |
| |
| |
| |
| | |
In order to use early hints, need to use Puma 3.11.0 or higher.
So, I think that should specify that version in newly generated applications.
Ref: https://github.com/puma/puma/commit/f6f3892f4d82638fb7a2a57d993641b1486ee88a
|
|\ \
| | |
| | | |
Clean database naming ambiguity
|
| | |
| | |
| | |
| | | |
In some places this file referred to the database in three different ways: database, DB and db. The last one caused confusion with the db namespace and the db folder. This commit removes this ambiguity by using the whole word 'database' everywhere
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
statement due to user request (#31235)
This changes `StatementTimeout` to `QueryCanceled` for PostgreSQL.
In MySQL, errno 1317 (`ER_QUERY_INTERRUPTED`) is only used when the
query is manually cancelled.
But in PostgreSQL, `QUERY_CANCELED` error code (57014) which is used
`StatementTimeout` is also used when the both case. And, we can not tell
which reason happened.
So I decided to introduce new error class `QueryCanceled` closer to the
error code name.
|
| | |
| | |
| | |
| | |
| | |
| | | |
Since #31129, new error class `StatementTimeout` has been added.
`TransactionTimeout` is caused by the timeout shorter than
`StatementTimeout`, but its name is too generic. I think that it should
be a name that understands the difference with `StatementTimeout`.
|
|\ \ \
| | | |
| | | | |
Remove field ids from scaffold form
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
This was added with 27f103fc7e3260efe0b8dde66bf5354f2202ee32 for link labels and fields.
However, `form_with` changed to generates ids by default with d3893ec38ec61282c2598b01a298124356d6b35a.
So I think that adding an explicit ids is unnecessary.
|