| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When applying default_scope to a class with a where clause, using
update_column(s) could generate a query that would not properly update
the record due to the where clause from the default_scope being applied
to the update query.
class User < ActiveRecord::Base
default_scope where(active: true)
end
user = User.first
user.active = false
user.save!
user.update_column(:active, true) # => false
In this situation we want to skip the default_scope clause and just
update the record based on the primary key. With this change:
user.update_column(:active, true) # => true
Backport of #8436 fix.
Conflicts:
activerecord/CHANGELOG.md
activerecord/lib/active_record/persistence.rb
activerecord/test/cases/persistence_test.rb
|
|
|
|
|
|
|
|
|
| |
Closes #3313
Conflicts:
activerecord/CHANGELOG.md
activerecord/test/models/developer.rb
|
|
|
|
|
|
|
|
| |
AR::Relation#pluck: improve to work with joins
Conflicts:
activerecord/lib/active_record/relation/calculations.rb
activerecord/test/cases/calculations_test.rb
|
|\
| |
| | |
Fixing a schema:load when using a prefix and suffix on the tables [Reopen/backport]
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Don't call will_change! for datetime nil->"".
Setting a nil datetime attribute to a blank string should not cause the
attribute to be dirty.
Conflicts:
activerecord/CHANGELOG.md
activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Closes #8265
Conflicts:
activerecord/CHANGELOG.md
activerecord/lib/active_record/associations/association.rb
|
| |
| |
| |
| |
| |
| |
| | |
Postgresql doesn't accepts limits on text columns
Conflicts:
activerecord/CHANGELOG.md
activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Add test to ensure preloading works as expected with "group", "select" and "includes".
Conflicts:
activerecord/test/cases/relations_test.rb
Chery-pick a739340d3c9e66814429af6f3f410c01ff86810a:
Ensure ordering to make the test pass with postgresql
Conflicts:
activerecord/test/cases/relations_test.rb
|
|\ \
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Backport 4bc2ae0 to fix #7950
Conflicts:
activerecord/CHANGELOG.md
activerecord/lib/active_record/relation/calculations.rb
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
See issue #7950.
The previous commit fixes this bug, and is a backport of
4bc2ae0da1dd812aee759f6d13ad428354cd0e13.
|
| | |
| | |
| | |
| | |
| | | |
Conflicts:
activerecord/test/cases/locking_test.rb
|
|\ \ \
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
backport #8176, `#pluck` can be used on a relation with `select` clause.
Conflicts:
activerecord/CHANGELOG.md
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Conflicts:
activerecord/CHANGELOG.md
activerecord/lib/active_record/relation/calculations.rb
activerecord/test/cases/calculations_test.rb
|
|\ \ \ \
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Use nil? instead of blank? to check dynamic finder result
Conflicts:
activerecord/CHANGELOG.md
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
It's safe to use `nil?` instead of `blank?` because it's impossible to get an array on finder with bang;
`all_by` finder matches against regex without bang: `when /^find_(all_|last_)?by_([_a-zA-Z]\w*)$/`.
Fixes #7238
|
|/ / / /
| | | |
| | | |
| | | | |
with optimistic locking enabled. Fixes #5332.
|
|/ / /
| | |
| | |
| | | |
database.yml but also DATABASE_URL.
|
| | | |
|
| | | |
|
|/ /
| |
| |
| |
| |
| |
| | |
Remove unwanted transaction when has one association is built
Conflicts:
activerecord/CHANGELOG.md
|
| |
| |
| |
| | |
Public method attributes_before_type_cast used to return internal AR structure (ActiveRecord::AttributeMethods::Serialization::Attribute), patch fixes this. Now behaves like read_attribute_before_type_cast and returns unserialised values.
|
|\ \
| | |
| | |
| | |
| | | |
alexisbernard/3-2_find_in_batches_compatible_with_strings
Fix find_in_batches with customized primary_key on 3-2-stable
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Conflicts:
activerecord/CHANGELOG.md
activerecord/lib/active_record/relation/batches.rb
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Related to 761bc751d31c22e2c2fdae2b4cdd435b68b6d783 and
eb876c4d07130f15be2cac7be968cc393f959c62
Conflicts:
activerecord/lib/active_record/relation/batches.rb
activerecord/test/cases/batches_test.rb
|
| | | |
|
|/ /
| |
| |
| | |
Closes GH-8131
|
| |
| |
| |
| | |
Also related to #8087. Thanks @al2o3cr.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When calling first(n) or last(n) in a collection, Active Record was
improperly trying to set the inverse of instance in case that option
existed. This change was introduced by
fdf4eae506fa9895e831f569bed3c4aa6a999a22.
In such cases we don't need to do that "manually", since the way
collection will be loaded will already handle that, so we just skip
setting the inverse association when any argument is given to
first(n)/last(n).
The test included ensures that these scenarios will have the inverse of
instance set properly.
Fixes #8087, Closes #8094.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This method returns the status of the operation,
but as we generally do in the code base it does
not commit to any particular exact value. Hence,
we do not have to check for a singleton, because
if the implementation changes and returns some
other true value the test should pass.
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| | |
This can occur if the user is using :integer columns to store boolean
values. Now we are handling the boolean values but it still raises if
the value can't type cast to integer and is not a boolean. See #7509.
Fixes #8067.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Backport for #7521
- added tests to confirm establish_connection uses DATABASE_URL and
Rails.env correctly even when no arguments are passed in.
- updated rake db tasks to support DATABASE_URL, and added tests to
confirm correct behavior for these rake tasks. (Removed
establish_connection call from some tasks since in those cases
the :environment task already made sure the function would be called)
- updated Resolver so that when it resolves the database url, it
removes hash values with empty strings from the config spec (e.g.
to support connection to postgresql when no username is specified).
- updated ResolverTest to use current_adapter? to check the type of
the current adapter.
|
| |
| |
| |
| |
| |
| | |
SQLite3Adapter#type_cast should not mutate arguments
Conflicts:
activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
|
| |
| |
| |
| |
| |
| |
| |
| | |
Unbreak update_column/update_columns for the primary key attribute.
Conflicts:
activerecord/CHANGELOG.md
activerecord/lib/active_record/persistence.rb
activerecord/test/cases/persistence_test.rb
|
| |
| |
| |
| | |
Also remove the feature detecting for Ruby 1.9
|
| |
| |
| |
| | |
Checking for the constant doesn't work
|
| |
| |
| |
| |
| |
| |
| | |
Decode attributes pulled from URI.parse
Conflicts:
activerecord/CHANGELOG.md
activerecord/lib/active_record/connection_adapters/connection_specification.rb
|
| | |
|
| |
| |
| |
| |
| |
| |
| | |
Dup'ed ActiveRecord objects may not share the errors object
Conflicts:
activerecord/CHANGELOG.md
activerecord/test/cases/dup_test.rb
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
PostgreSQL adapter properly parses default values when using multiple
schemas and domains.
When using domains across schemas, PostgresSQL prefixes the type of the
default value with the name of the schema where that type (or domain) is.
For example, this query:
```
SELECT a.attname, d.adsrc
FROM pg_attribute a LEFT JOIN pg_attrdef d
ON a.attrelid = d.adrelid AND a.attnum = d.adnum
WHERE a.attrelid = "defaults"'::regclass
AND a.attnum > 0 AND NOT a.attisdropped
ORDER BY a.attnum;
```
could return something like "'<default_value>'::pg_catalog.text" or
"(''<default_value>'::pg_catalog.text)::text" for the text columns with
defaults.
I modified the regexp used to parse this value so that it ignores
anything between ':: and \b(?:character varying|bpchar|text), and it
allows to have optional parens like in the above second example.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
If you create a new record via a collection association proxy that has
not loaded its target, and which selects additional attributes through
the association, then when the proxy loads its target, it will
inadvertently trigger a deprecation notice during attribute writing when
CollectionAssociation#merge_target_lists attempts to do its thing, since
the newly loaded records will possess attributes the created record does
not.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
senny/5920_postgres_adapter_table_with_capital_letters
postgres, quote table names when fetching the primary key (#5920)
Conflicts:
activerecord/CHANGELOG.md
activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb
|
| |
| |
| |
| | |
Count returns 0 without querying if parent is not saved
|
| |
| |
| |
| |
| |
| |
| | |
Fix reset_counters crashing on has_many :through associations.
Conflicts:
activerecord/CHANGELOG.md
activerecord/lib/active_record/counter_cache.rb
|
| | |
|
| |
| |
| |
| |
| |
| |
| | |
Backport of #6441 cb6f83935 . Old 'wait_timeout' is still supported,
but conflicts with mysql2 using that spec key for different thing.
'checkout_timeout' can now be used taking precedence for ConnectionPool
over 'wait_timeout'.
|