| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| | |
Properly indent '<head>' and '<body>' within '<html>'
|
| | |
|
|/
|
|
| |
This method was already niche, and is now redundant with `.new`
|
|\
| |
| |
| |
| | |
`HashWithIndifferentAccess.new` respects the default value or proc on
objects that respond to `#to_hash`
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
objects that respond to `#to_hash`.
Builds on the work of #12550 where `.new` will convert the object (that respond to `#to_hash`) to a hash and
add that hash's keys and values to itself.
This change will also make `.new` respect the default value or proc of objects that respond to `#to_hash`.
In other words, this `.new` behaves exactly like `.new_from_hash_copying_default`.
`.new_from_hash_copying_default` now simply invokes `.new` and any references to `.new_from_hash_copying_default`
are replaced with `.new`.
Added tests confirm behavior.
|
|\ \
| | |
| | |
| | | |
DRY up STI subclass logic
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
We don't need to use `String#+` or create all the intermediate strings
to break a string into multiple lines. We can just write a c-style
multiline string literal. This is by no means a hotpath, but this is
clearer to me anyway.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The first one is quite straightforward. We want to give the proper error
message in the case where a top level constant exists, but we're looking
for a nested one. We just need to port over the change to use
`subclass.name` into these changes.
The second set of failures, which are only present in the mysql adapter
tests, are stranger to me. The failure occurs because we were
previously comparing `subclass.name == self.name` instead of `subclass
== self`. However, I don't think that we need to support creating
anonymous classes which share a table with a class that uses STI,
overrides `name` to return the same name as athe class that we have no
other relationship with, when not assigned to a constant so it could
never be used anyway...
The commits around why that exist give no context, and I think they're
just poorly written tests (WTF does `test_schema` mean anyway, and why
does calling `.first` on some anonymous class test it?). We'll just
disable STI on that class.
|
| |\ \
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
I'm making this commit separately because this has failing tests and
style nitpicks that I'd like to make as individual commits, to make the
changes I'm making explicit.
We still want a single merge commit at the end, however.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
the newer method used for discriminating new records did not
use the older and more robust method used for instantiating
existing records, but did have a better post-check to ensure
the sublass was in the hierarchy. so move the descendants check
to find_sti_class, and then simply call find_sti_class from
subclass_from_attributes
now with fixed specs
|
|\ \ \ \
| | | | |
| | | | | |
Set `scope.reordering_value` to `true` if :reordering values aren't nil
|
| |/ / /
| | | |
| | | |
| | | |
| | | |
| | | | |
We should call `scope.order!` and set `scope.reordering_value` to `true` if :reordering values are specified
Fixes #21886
|
|\ \ \ \
| |/ / /
|/| | | |
Fix a faulty form_for test
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Stumbled upon this one while trying to deprecate the String/Symbol
passing to `form_for`.
This test passed on an accident, because the signature of `form_for`
currently accepts 2 positional arguments and a block. Calling it with
the wrong number of arguments caused:
```ruby
(byebug) form_for(:post, @post, html: { id: 'create-post' })
*** ArgumentError Exception: wrong number of arguments (3 for 1..2)
```
This made the test pass, because it was still an `ArgumentError`. :-)
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
This solves the following issue:
```
$ bin/test
Using sqlite3
/Users/senny/Projects/rails/activerecord/test/cases/adapters/mysql2/sp_test.rb:16:in `<class:Mysql2StoredProcedureTest>': undefined method `version' for #<ActiveRecord::ConnectionAdapters::SQLite3Adapter:0x007f8bab4b5b70> (NoMethodError)
from /Users/senny/Projects/rails/activerecord/test/cases/adapters/mysql2/sp_test.rb:5:in `<top (required)>'
from /Users/senny/Projects/rails/activesupport/lib/active_support/dependencies.rb:302:in `require'
from /Users/senny/Projects/rails/activesupport/lib/active_support/dependencies.rb:302:in `block in require'
from /Users/senny/Projects/rails/activesupport/lib/active_support/dependencies.rb:268:in `load_dependency'
from /Users/senny/Projects/rails/activesupport/lib/active_support/dependencies.rb:302:in `require'
from /Users/senny/Projects/rails/railties/lib/rails/test_unit/test_requirer.rb:11:in `block in require_files'
from /Users/senny/Projects/rails/railties/lib/rails/test_unit/test_requirer.rb:10:in `each'
from /Users/senny/Projects/rails/railties/lib/rails/test_unit/test_requirer.rb:10:in `require_files'
from /Users/senny/Projects/rails/railties/lib/rails/test_unit/minitest_plugin.rb:69:in `plugin_rails_init'
from /Users/senny/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/minitest-5.3.3/lib/minitest.rb:73:in `block in init_plugins'
from /Users/senny/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/minitest-5.3.3/lib/minitest.rb:71:in `each'
from /Users/senny/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/minitest-5.3.3/lib/minitest.rb:71:in `init_plugins'
from /Users/senny/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/minitest-5.3.3/lib/minitest.rb:122:in `run'
from bin/test:19:in `<main>'
```
|
|\ \ \ \
| | | | |
| | | | | |
Use #distinct instead of #uniq in the guides
|
|/ / / /
| | | |
| | | |
| | | |
| | | | |
* #uniq is an alias of #distinct
* #uniq will be deprecated, see: rails/rails@adfab2dcf4003ca564d78d4425566dd2d9cd8b4f
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
It's already represented in the key name. Demonstrate with a test.
Also test that the default isn't output.
|
|\ \ \ \
| | | | |
| | | | | |
Allow rake:stats to account for rake tasks
|
| | | | | |
|
|\ \ \ \ \
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
sebjacobs/support-bidirectional-destroy-dependencies
Add support for bidirectional destroy dependencies
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Prior to this commit if you defined a bidirectional relationship
between two models with destroy dependencies on both sides, a call to
`destroy` would result in an infinite callback loop.
Take the following relationship.
class Content < ActiveRecord::Base
has_one :content_position, dependent: :destroy
end
class ContentPosition < ActiveRecord::Base
belongs_to :content, dependent: :destroy
end
Calling `Content#destroy` or `ContentPosition#destroy` would result in
an infinite callback loop.
This commit changes the behaviour of `ActiveRecord::Callbacks#destroy`
so that it guards against subsequent callbacks.
Thanks to @zetter for demonstrating the issue with failing tests[1].
[1] rails#13609
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
Remove required `sdoc` from Rakefile
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
This is required inside `api/task`
|
|\ \ \ \ \ \ \
| | | | | | | |
| | | | | | | | |
[ci skip] Add `:binds` to a list of paramaters of `sql.active_record`
|
| | | | | | | | |
|
|\ \ \ \ \ \ \ \
| |/ / / / / / /
|/| | | | | | | |
specify deprecated waring, follow the standard conventions
|
|/ / / / / / /
| | | | | | |
| | | | | | |
| | | | | | | |
`skip_filter`, `skip_action_callback` may both are deprecated in Rails 5.1 so waring msg should be specific.
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
For ActionController::Base we write the cookies in a middleware if it
was not yet committed no matter if the response was committed or not. [1]
For ActionController::Live we write the cookies before the response is
committed. [2]
We already mimic ActionController::Live in
ActionController::TestCase but we don't mimic the ActionController::Base
behavior because we were checking if the response was committed before
writing the cookies.
Now we are matching the behavior of the middleware and writing the
cookies if it was not written before.
[1]: https://github.com/rails/rails/blob/80c6b901d4d87cee610ab0a438ff6e3c6bf118d1/actionpack/lib/action_dispatch/middleware/cookies.rb#L599-L604
[2]: https://github.com/rails/rails/blob/80c6b901d4d87cee610ab0a438ff6e3c6bf118d1/actionpack/lib/action_controller/metal/live.rb#L218-L223
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
This is leftover from when `render nothing: true` rendered blank string.
|
|\ \ \ \ \ \ \
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
ajmyers01/fix_typo_in_eager_load_polymorphic_error
Fix Typo in EagerLoadPolymorphicError [ci skip]
|
|/ / / / / / / |
|
|\ \ \ \ \ \ \
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
scambra/habtm-with-where-includes-16032-for-master
Includes HABTM returns correct size now
|
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
only instantiates one HABTM object because the join table hasn't a primary key.
Updated commit from @bigxiang commit dbaa837
Fixes #16032.
Examples:
before:
Project.first.salaried_developers.size # => 3
Project.includes(:salaried_developers).first.salaried_developers.size # => 1
after:
Project.first.salaried_developers.size # => 3
Project.includes(:salaried_developers).first.salaried_developers.size # => 3
|
|\ \ \ \ \ \ \ \
| | | | | | | | |
| | | | | | | | | |
fix typo in `db:purge` description [ci skip]
|
|/ / / / / / / / |
|
|\ \ \ \ \ \ \ \
| | | | | | | | |
| | | | | | | | | |
[ci skip] Aline code examples in AR changelog
|
| | | | | | | | | |
|
|\ \ \ \ \ \ \ \ \
| |/ / / / / / / /
|/| | | | | | | | |
raise `ArgumentError` when `SECRET_KEY_BASE` is an integer
|
|/ / / / / / / /
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
If `SECRET_KEY_BASE` or other `secret` gets passed as other then string
we need to raise `ArgumentError` to know that it's a wrong argument.
Closes #22072
|
| | | | | | | | |
|
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
This reverts commit 60c9701269f5b412849f1a507df61ba4735914d7, reversing
changes made to 6a25202d9ea3b4a7c9f2d6154b97cf8ba58403db.
Reason: Broken build
|
|\ \ \ \ \ \ \ \
| | | | | | | | |
| | | | | | | | |
| | | | | | | | | |
Fix InheritanceTest#test_scope_inherited_properly implementation bugs
|
|/ / / / / / / /
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
This triggers the JoinDependency work to reflect on the associations
and trigger an error as follows:
ActiveRecord::ConfigurationError: Association named 'account' was
not found on Company; perhaps you misspelled it?
Fix Company.of_first_firm joins association name
Should be `Company.joins(:accounts)` not `Company.joins(:account)`.
Do the same for Client.of_first_firm
|
| | | | | | | | |
|
| | | | | | | | |
|
| | | | | | | | |
|
|\ \ \ \ \ \ \ \
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | | |
Errors can be indexed with nested attributes
Close #8638
|
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | | |
`has_many` can now take `index_errors: true` as an
option. When this is enabled, errors for nested models will be
returned alongside an index, as opposed to just the nested model name.
This option can also be enabled (or disabled) globally through
`ActiveRecord::Base.index_nested_attribute_errors`
E.X.
```ruby
class Guitar < ActiveRecord::Base
has_many :tuning_pegs
accepts_nested_attributes_for :tuning_pegs
end
class TuningPeg < ActiveRecord::Base
belongs_to :guitar
validates_numericality_of :pitch
end
```
- Old style
- `guitar.errors["tuning_pegs.pitch"] = ["is not a number"]`
- New style (if defined globally, or set in has_many_relationship)
- `guitar.errors["tuning_pegs[1].pitch"] = ["is not a number"]`
[Michael Probber, Terence Sun]
|
|\ \ \ \ \ \ \ \ \
| | | | | | | | | |
| | | | | | | | | | |
Edits default `config/boot.rb` to match what's generated by Rails 4.2.
|