Commit Graph

222 Commits

Author SHA1 Message Date
Rafael Mendonça França
53c845cb18 Preparing for 3.2.19 release 2014-07-02 12:55:09 -03:00
Rafael Mendonça França
4e8f1d2588 Preparing for 3.2.18 release 2014-05-06 11:33:10 -03:00
Aaron Patterson
538f8ba0c1 updating changelogs 2013-10-16 10:01:01 -07:00
Rafael Mendonça França
38aefa51c3 Revert "Merge pull request #12413 from arthurnn/inverse_of_on_build"
This reverts commit ccd11d5891, reversing
changes made to 54c05acdba.

Reason: This caused a regression when the associated record is created
in a before_create callback. See
https://github.com/rails/rails/pull/12413#issuecomment-25848163
2013-10-10 14:55:12 -03:00
Arthur Neves
679860400f Move set_inverse_instance to association.build_record
[fixes #10371]
2013-09-30 17:20:26 -04:00
Arthur Neves
fed6ac9c66 fix inverse_of when find_or_initialize_by_*
inverse_of relation was not being set when calling find_or_initialize_by_ and the entry was
found on the db.
2013-09-26 14:55:10 -04:00
Rafael Mendonça França
fdc3c08e55 Merge pull request #12359 from arthurnn/inverse_on_callbacks
Make sure inverse_of is visible on the has_many callbacks
Conflicts:
	activerecord/CHANGELOG.md
	activerecord/test/models/company.rb
2013-09-25 16:31:00 -03:00
Eugene Kalenkovich
c9642e31b1 Fix FinderMethods#last unscoped primary key
Fixes table.joins(:relation).last(N) breaking on sqlite

Conflicts:
	activerecord/CHANGELOG.md
	activerecord/test/cases/finder_test.rb
2013-09-12 14:08:02 -03:00
Kassio Borges
0ec701d50b Load fixtures from linked folders 2013-08-05 16:52:12 -03:00
Ben Woosley
b4dea61a42 Tidy up the "Specified column type for quote_value" changes
This includes fixing typos in changelog, removing a deprecated
mocha/setup test require, and preferring the `column_for_attribute`
accessor over direct access to the columns_hash in the new code.

Conflicts:
	activerecord/CHANGELOG.md
	activerecord/lib/active_record/locking/optimistic.rb
2013-07-24 13:20:30 -03:00
Alfred Wong
33e1604b3e Specified column type for quote_value
When calling quote_value the underlying connection sometimes requires
more information about the column to properly return the correct quoted
value.

I ran into this issue when using optimistic locking in JRuby and the
activerecord-jdbcmssql-adapter. In SQLSever 2000, we aren't allowed to
insert a integer into a NVARCHAR column type so we need to format it as
N'3' if we want to insert into the NVARCHAR type. Unfortuantely, without
the column type being passed the connection adapter cannot properly return
the correct quote value because it doesn't know to return N'3' or '3'.

This patch is fairly straight forward where it just passes in the column
type into the quote_value, as it already has the ability to take in the column,
so it can properly handle at the connection level.

I've added the tests required to make sure that the quote_value method
is being passed the column type so that the underlying connection can
determine how to quote the value.

Conflicts:
	activerecord/CHANGELOG.md
	activerecord/lib/active_record/locking/optimistic.rb
2013-07-24 13:18:21 -03:00
90yukke
b289519f4f Fix merge error when Equality LHS is non-attribute.
This is reworking of rails/rails/pull/7380 made for rails 3.
2013-07-23 10:38:00 +03:00
Rafael Mendonça França
47fb44fc7a Update CHANGELOG entry 2013-07-22 11:57:02 -03:00
Rafael Mendonça França
a96df04aac Preparing for 3.2.14.rc2 release 2013-07-16 13:00:33 -03:00
Yves Senn
2ae2728d78 Merge pull request #11451 from jetthoughts/11450_do_not_resave_destroyed_association
Do not re-save destroyed association on saving parent object
Conflicts:
	activerecord/lib/active_record/autosave_association.rb
2013-07-15 15:48:43 -03:00
Rafael Mendonça França
facfc24f25 Preparing for 3.2.14.rc1 release 2013-07-12 21:06:50 -03:00
Rafael Mendonça França
d704c1cb98 Do not shallow the original exception in exec_cache
when result_error_field is not defined on result raise the original
exception.

Fixes #11260
2013-07-09 07:41:32 -03:00
chapmajs
839efc5b6d Allow global override of default STI inheritance column
This change fixes a bug by which 3.2-STABLE users can't globally override the default STI inheritance column with `ActiveRecord::Base.inheritance_column = 'some_column'`. 3.2-STABLE users are forced to use a deprecated method or monkey patch it otherwise.

Test case written by tkhr <takehiro0740@gmail.com>.
2013-06-26 14:55:18 +09:00
Carlos Antonio da Silva
cde6ead573 Move changelog entry to the top [ci skip] 2013-06-25 22:05:54 -03:00
Carlos Antonio da Silva
07c6262c25 Merge pull request #10373 from janko-m/fix-store-accessor
Fix a bug in ActiveRecord::Store accessors
2013-06-25 22:03:01 -03:00
Yves Senn
27b3883846 Revert "Revert "Merge pull request #10901 from armstrjare/fix_query_null_foreign_key_on_new_record_collection_ids_reader""
This reverts commit 5009b07887.

Also updated the CHANGELOG and adjusted the test-case to match the one on master.
2013-06-25 18:07:06 +02:00
Yves Senn
5009b07887 Revert "Merge pull request #10901 from armstrjare/fix_query_null_foreign_key_on_new_record_collection_ids_reader"
This reverts commit 6675d71318, reversing
changes made to 919d1a19d5.

I missed to check the target branch and wrongly merged it into 3-2-stable directly.
2013-06-22 12:15:42 +02:00
Yves Senn
6675d71318 Merge pull request #10901 from armstrjare/fix_query_null_foreign_key_on_new_record_collection_ids_reader
Fixes CollectionAssociation#ids_reader returning incorrect ids for new records
2013-06-22 03:11:19 -07:00
Jared Armstrong
c2377f72d2 Fixes CollectionAssociation#ids_reader returning incorrect ids for new records 2013-06-21 13:03:54 +12:00
Yves Senn
a51d4e6c25 Merge pull request #10925 from senny/10917_test_to_prevent_regression
regression test + mysql2 adapter raises correct error if conn is closed.
Conflicts:

	activerecord/CHANGELOG.md
2013-06-15 14:51:17 +02:00
Rafael Mendonça França
d29399061e Merge pull request #10713 from senny/10693_fix_primary_key_option_on_has_many
Fix the `:primary_key` option for `has_many` associations.
Conflicts:
	activerecord/CHANGELOG.md
	activerecord/lib/active_record/associations/has_many_association.rb
2013-05-23 18:45:12 -03:00
Johnny Holton
c2362461cd destroys association records before saving/inserting new association records
This is a backport of #10417

fixes bug introduced by  #3329
These are the conditions necessary to reproduce the bug:
- For an association, autosave => true.
- An association record is being destroyed
- A new association record is being created.
- There is a unique index one of the association's fields.
- The record being created has the same value as the record being
destroyed on the indexed field.

Before, the deletion of records was postponed until after all
insertions/saves.  Therefore the new record with the identical value in
the indexed field caused a non-unique value error to be thrown at the
database
level.

With this fix, the deletions happen first, before the insertions/saves.
Therefore the record with the duplicate value is gone from the database
before the new record is created, thereby avoiding the non-uniuqe value
error.
2013-05-18 18:20:52 -04:00
Ben Woosley
23c656c1bc Backport a super-simplified version of #6792, fixing
that #exists? and others can produce invalid SQL: "SELECT DISTINCT DISTINCT"

The combination of a :uniq => true association and the #distinct call
in #construct_limited_ids_condition combine to create invalid SQL, because
we're explicitly selecting DISTINCT, and also sending #distinct on to AREL,
via the relation#distinct_value.

Where #6792 was the forever fix, this is the minimal fix. Instead of
properly indicating the distinctness of the query through #uniq_value alone,
we use a literal select statement and set #uniq_value to always be falsey
2013-05-14 16:03:17 +02:00
Rafael Mendonça França
b1fb8efd9b Improve CHANGELOG entries
[ci skip]
2013-05-12 18:45:57 -03:00
Rafael Mendonça França
442b7c8ccf Merge pull request #7695 from benolee/backport_cc7dd66_and_c0ba0f0
backport runner fixes to 3-2-stable

Conflicts:
	railties/CHANGELOG.md
2013-05-12 15:13:47 -03:00
Andrew Horner
c09829e03d Preserve context for joins while merging relations
This is a backport of #10164, already merged into
master. The issue is described in lengthy detail
in issues #3002 and #5494.
2013-05-11 22:41:47 -05:00
Daniel Schierbeck
ddaa5d5181 Don't try to EXPLAIN select_db calls
Now with a non-broken test.
2013-05-12 00:33:01 +02:00
Rafael Mendonça França
84c69a1653 Revert "Merge pull request #8209 from senny/backport_8176"
This reverts commit 7240202784, reversing
changes made to e4e2bcce75.

Conflicts:
	activerecord/CHANGELOG.md
	activerecord/lib/active_record/relation/calculations.rb
	activerecord/test/cases/calculations_test.rb

Reason: This caused a regression since it changed the behavior in a
stable release.

Fixes #9777
2013-05-08 23:34:24 -03:00
Rafael Mendonça França
f8c4a31e0b Merge pull request #10489 from greenriver/ar_counter_cache_multiple_destroy
Confirm a record has not already been destroyed before decrementing counter cache

Conflicts:
	activerecord/CHANGELOG.md

Conflicts:
	activerecord/CHANGELOG.md
	activerecord/lib/active_record/associations/builder/belongs_to.rb
2013-05-06 22:44:01 -03:00
Janko Marohnić
5519468523 Fix ActiveRecord::Store not tracking changes 2013-04-29 20:39:52 +02:00
Erik Peterson
a6d9e16e41 Correctly parse bigint defaults in PostgreSQL, Backpost #10098.
Conflicts:

	activerecord/CHANGELOG.md
	activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
	activerecord/test/cases/schema_dumper_test.rb
2013-04-11 10:11:18 +02:00
Carlos Antonio da Silva
e59f3809ef Merge pull request #7792 from seejee/chained_scopes_preload_properly
Fixes Issue #7490: Chained scopes will preload properly
2013-04-03 15:43:59 -07:00
Chris Geihsler
453c7d6c47 Chained scopes will be preloaded properly. Fixes #7490 2013-04-03 18:41:12 -04:00
Rafael Mendonça França
e06b4fab8e Removing explain support warning from the Railtie
This is causing a regression since the Active Record Railtie is trying to
connect to the development database in the application boot.

See https://github.com/rails/rails/pull/6197#issuecomment-15199273
2013-03-28 13:21:56 -03:00
Fred Wu
8bd56f0f7a Added changelog for 55e2954 2013-03-27 09:20:04 +11:00
Carlos Antonio da Silva
7e8a74d401 Remove bad changelog entry from AR [ci skip]
Introduced in dc2bc388bc.
2013-03-20 12:09:56 -03:00
kennyj
dc2bc388bc Wrong exception is occured when raising no translatable exception
Conflicts:
	activerecord/CHANGELOG.md
2013-03-20 10:11:07 +00:00
Alexander
ca6a12d6e5 Reset postgreSQL search path in db:test:clone_structure.
This patch resets the postgres search path in the structure.sql after
the structure is dumped in order to find schema_migrations table when
multiples schemas are used.

Fixes #945
2013-03-19 19:34:56 +04:00
claudiob
0e56c1de70 Add release dates to documentation [ci skip]
Set "March 18, 2013" as the release date for 3.2.13
2013-03-18 14:51:46 -07:00
Carlos Antonio da Silva
167b645a2a Bring back test and changelog entry from #pluck method and select clause 2013-03-18 18:28:07 -03:00
Carlos Antonio da Silva
a8e7a009d2 Fix changelog conflicts and remove release dates [ci skip] 2013-03-18 18:18:55 -03:00
Aaron Patterson
afcd01bf25 Merge branch '3-2-13' into 3-2-stable
* 3-2-13:
  bumping to 3.2.13
  fix protocol checking in sanitization [CVE-2013-1857]
  JDOM XXE Protection [CVE-2013-1856]
  fix incorrect ^$ usage leading to XSS in sanitize_css [CVE-2013-1855]
  stop calling to_sym when building arel nodes [CVE-2013-1854]
  Merge pull request #9616 from exviva/multiple_select_name_double_square_brackets
  bumping to rc2
  Revert "Merge pull request #8209 from senny/backport_8176"
  Freeze columns only once per Result
  Preparing for 3.2.13.rc1 release
  Update CHANGELOGs for 3.2.13 release.

Conflicts:
	actionmailer/CHANGELOG.md
	actionpack/CHANGELOG.md
	activemodel/CHANGELOG.md
	activeresource/CHANGELOG.md
	activesupport/CHANGELOG.md
	railties/CHANGELOG.md
2013-03-18 10:17:04 -07:00
Rafael Mendonça França
9bd5c86c3b Merge pull request #9549 from larrylv/reload-stable-target-before-saving
Fix issue #7526. Reload the association target if it's stale.
2013-03-07 08:23:23 -08:00
Aaron Patterson
1b699fc8ad Revert "Merge pull request #8209 from senny/backport_8176"
This reverts commit 7240202784, reversing
changes made to e4e2bcce75.

Conflicts:
	activerecord/CHANGELOG.md
	activerecord/lib/active_record/relation/calculations.rb
	activerecord/test/cases/calculations_test.rb
2013-03-05 11:33:16 -08:00
Steve Klabnik
51ae6f4bb1 Update CHANGELOGs for 3.2.13.rc1 2013-03-05 11:22:55 -08:00