Commit Graph

3046 Commits

Author SHA1 Message Date
Pratik Naik
2d6d8a72a3 Ensure association preloading properly merges default scope and association conditions 2012-08-28 12:50:06 -07:00
Aaron Patterson
64e30e8b34 Merge branch '3-1-stable-sec' into 3-1-stable-rel
* 3-1-stable-sec:
  Array parameters should not contain nil values.
  Additional fix for CVE-2012-2661
2012-06-11 15:42:40 -07:00
Rafael Mendonça França
3e2c00a1dc Mysql and Mysql2 adapters accepts only two arguments in the tables
method.

Fix build http://travis-ci.org/#!/rails/rails/builds/1594492
2012-06-11 18:09:09 -03:00
kennyj
8e6ed58e43 Change the string to use in test case.
Conflicts:

	activerecord/test/cases/adapters/mysql/mysql_adapter_test.rb
	activerecord/test/cases/adapters/mysql2/schema_test.rb
2012-06-11 11:27:54 -07:00
kennyj
023eaf8ab9 Fix GH #3163. Should quote database on mysql/mysql2.
Conflicts:

	activerecord/test/cases/adapters/mysql/mysql_adapter_test.rb

Conflicts:

	activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
	activerecord/test/cases/adapters/mysql/mysql_adapter_test.rb
2012-06-11 11:27:45 -07:00
Ernie Miller
8355abf153 Additional fix for CVE-2012-2661
While the patched PredicateBuilder in 3.1.5 prevents a user
from specifying a table name using the `table.column` format,
it doesn't protect against the nesting of hashes changing the
table context in the next call to build_from_hash. This fix
covers this case as well.
2012-06-08 17:26:52 -05:00
Aaron Patterson
b71d4ab9d7 predicate builder should not recurse for determining where columns.
Thanks to Ben Murphy for reporting this

CVE-2012-2661
2012-05-30 15:05:19 -07:00
Santiago Pastorino
5cbb20d053 Merge pull request #5658 from yahonda/address_ora_00918_with_oracle_for_3_1
Address an error for test_has_many_through_polymorphic_has_one with Oracle
2012-03-29 13:11:53 -07:00
Yasuo Honda
53db676a5e Address an error for test_has_many_through_polymorphic_has_one
with Oracle for the 3-1-stable branch
2012-03-29 13:09:51 -04:00
Arturo Pie
15a2e0dee2 refactor the checking of the attributes of the record in IdentityMap#add, so it's more readable 2012-03-27 21:59:46 -04:00
Arturo Pie
488ea89a4b Adds a test that breaks IM when using #select 2012-03-27 21:59:46 -04:00
Carlos Antonio da Silva
c8d5680655 Fix identity map tests 2012-03-23 14:39:42 -03:00
Carlos Antonio da Silva
51bb1c1d7a Add order to tests that rely on db ordering, to fix failing tests on pg
Also skip persistente tests related to UPDATE + ORDER BY for postgresql

PostgreSQL does not support updates with order by, and these tests are
failing randomly depending on the fixture loading order now.
2012-03-23 14:39:37 -03:00
Arun Agrawal
eeee6f2dbe fix test failing in 1.8.7 2012-03-19 11:32:56 +05:30
Denis Jean
b1fe2c6606 fix activerecord query_method regression with offset into Fixnum
add test to show offset query_methods on mysql & mysql2

change test to cover public API
2012-03-13 08:53:37 +05:30
Carlos Antonio da Silva
24e074fde8 Only run binary type cast test with encode! on Ruby 1.9 2012-03-04 16:36:45 +01:00
Aaron Patterson
b1358c8fa1 only log an error if there is a logger. fixes #5226
Conflicts:

	activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb

Conflicts:

	activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
2012-03-02 10:31:12 -08:00
kennyj
42592b4338 Fix type_to_sql with text and limit on mysql/mysql2. Fix GH #3931. 2012-02-29 01:51:29 +09:00
Aaron Patterson
f468d6e94f Merge pull request #5096 from lawso017/master
Restoring ability to derive id/sequence from tables with nonstandard sequences for primary keys
Conflicts:

	activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
	activerecord/test/cases/adapters/postgresql/schema_test.rb
2012-02-21 09:51:47 -08:00
kennyj
daa8686ca4 Fix GH #4754. Remove double-quote characters around PK when using sql_mode=ANSI_QUOTES 2012-01-31 20:53:38 +09:00
Tom Stuart
cda5094abd Test that #[] and #[]= keep working when #read_attribute and #write_attribute are overridden 2012-01-12 09:14:31 +00:00
Tom Stuart
f22c36bc82 Test ActiveRecord::Base#[]= as well as #write_attribute 2012-01-12 09:14:31 +00:00
Sergey Nartimov
9f7fe5d38b backport call scope within unscoped to prevent duplication of where values 2011-12-18 20:42:17 +03:00
Jon Leighton
df932c4ae2 Fix #3987.
Conflicts:

	activerecord/lib/active_record/attribute_methods/primary_key.rb
	activerecord/test/cases/primary_keys_test.rb
2011-12-15 13:38:25 +00:00
Jon Leighton
63293d1bc8 Fix #3890. (Calling proxy_association in scope chain.)
Conflicts:

	activerecord/test/models/post.rb
2011-12-08 20:13:26 +00:00
Jon Leighton
c1e2c1a7dc Avoid postgres 9.X syntax 2011-12-03 20:12:57 +00:00
Jon Leighton
6fd9c1d22e don't alter global state in test 2011-11-30 23:56:08 +00:00
Julius de Bruijn
5f27545ef5 If the table behind has no primary key, do not ask again and just return nil.
Conflicts:

	activerecord/test/cases/attribute_methods_test.rb
2011-11-30 23:55:57 +00:00
Jon Leighton
c5197d47d4 Verify that #3690 has been closed by previous changes to the mysql
adapters.

These tests fail on the v3.1.2 tag.

Closes #3690.

Conflicts:

	activerecord/CHANGELOG.md
2011-11-19 12:36:59 +00:00
Juan M. Cuello
b02daec718 Backport #3232 to 3-1-stable.
Use the schema_search_path in prepared statements in postgres.

Only the tests are backported, the fix was already included by
commit 818d285305.
2011-11-15 10:20:32 -03:00
Aaron Patterson
a0184038e0 Merge pull request #3521 from nulogy/fix_postgres_adapter_to_handle_spaces_between_schemas
Fix postgres adapter to handle spaces between schemas
2011-11-06 08:15:34 -08:00
kennyj
fb73423370 Barckport to 3-1-stable: fixed an issue id false option is ignored on mysql/mysql2 (fix #3440) 2011-11-06 03:28:14 +09:00
Sean Kirby
58f2fbc2ad fixes bug with PostgreSQLAdapter#indexes
When the search path has multiple schemas, spaces were not being stripped
from the schema names after the first.
2011-11-04 12:33:25 -04:00
Justin Mazzi
bad2d6fdaf Preserve SELECT columns on the COUNT for finder_sql when possible.
Pull request #3503
2011-11-03 21:15:23 -04:00
Jon Leighton
d5e63b1a01 Fix #3271.
Building the conditions of a nested through association could
potentially modify the conditions of the through and/or source
association.

This is a Bad Thing.

Conflicts:

	activerecord/test/cases/reflection_test.rb
2011-11-03 15:12:47 +00:00
Jon Leighton
e8ce2a5291 Remove all revelant through records.
If a record is removed from a has_many :through, all of the join records
relating to that record should also be removed from the through
association's target.

(Previously the records were removed in the database, but only one was
removed from the in-memory target array.)
2011-11-03 13:13:53 +00:00
Jon Leighton
175c02d630 Fix adding multiple instances of the same record to a has_many :through.
Fixes #3425.
2011-11-03 12:39:16 +00:00
Jon Leighton
01eae34d58 Fix #3247.
Fixes creating records in a through association with a polymorphic source
type.

Conflicts:

	activerecord/CHANGELOG
2011-11-03 10:27:08 +00:00
Joe Van Dyk
931775234a Added failing test case for changing schema in migration not clearing the prepared statement cache 2011-10-27 10:57:03 -07:00
Aaron Patterson
88ac481b46 Merge pull request #3258 from ileitch/3-1-stable
Postgres: Do not attempt to deallocate a statement if the connection is no longer active.
2011-10-20 08:44:55 -07:00
Aaron Patterson
818d285305 reset prepared statement when schema changes imapact statement results. fixes #3335 2011-10-18 11:19:42 -07:00
Ian Leitch
fc55fa7a14 Postgres: Do not attempt to deallocate a statement if the connection is no longer active. 2011-10-08 18:06:18 +01:00
Arun Agrawal
b5439b45f4 Fixed BodyProxy.new for tests! 2011-10-08 09:58:28 +05:30
Jon Leighton
f8beca00dc Raise an exception on unknown primary key inside AssociationReflection.
An association between two models cannot be made if a relevant key is
unknown, so fail fast rather than generating invalid SQL. Fixes #3207.
2011-10-05 20:24:45 +01:00
Jon Leighton
45c56bdd2d Don't call self.class unless necessary. Closes #3171. 2011-09-29 18:00:48 +01:00
Santiago Pastorino
85f8458e1b Fix tests in 1.8.7 2011-09-28 23:16:57 -03:00
Jon Leighton
75e97a4888 Don't require a DB connection when setting primary key.
Closes #2807.
2011-09-26 18:16:19 +01:00
Jon Leighton
5767609e8e Merge pull request #3030 from htanata/fix_habtm_select_query_method
Fix: habtm doesn't respect select query method
2011-09-26 08:45:53 -07:00
Jon Leighton
4aeb7f2eb7 Fix belongs_to polymorphic with custom primary key on target.
Closes #3104.
2011-09-26 15:43:04 +01:00
Jon Leighton
6c5295f473 Add deprecation for the preload_associations method. Fixes #3022. 2011-09-26 14:15:09 +01:00