Commit Graph

3131 Commits

Author SHA1 Message Date
Aaron Patterson
ee9d9fb5fa 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:45:22 -07:00
Aaron Patterson
c2f3c9bf56 only use now() on pg! 2011-10-18 13:30:01 -07:00
Aaron Patterson
6a28c512e3 reset prepared statement when schema changes imapact statement results. fixes #3335 2011-10-18 11:20:13 -07:00
Aaron Patterson
76af2818a6 use now() for dates in pg 2011-10-18 10:07:40 -07:00
José Valim
7511f9794d Merge pull request #3340 from surfacedamage/exclude_destroy_in_all_blank_check
Exclude _destroy parameter in :all_blank check (issue #2937)
2011-10-17 11:15:58 -07:00
Aaron Christy
8510a0bb5a Exclude _destroy parameter in :all_blank check (issue #2937) 2011-10-17 13:29:11 -04:00
Aaron Patterson
8919a68b96 Merge pull request #3334 from mperham/master
Default timestamps to non-null
2011-10-16 16:14:56 -07:00
Vishnu Atrai
9210458547 fix to remove warning in test cases 2011-10-16 14:29:06 +05:30
Mike Perham
3dbedd2823 Default timestamps to non-null 2011-10-14 21:09:53 -07:00
Christian Bäuerlein
410fa4cf7c Includes stale record in StaleObjectError 2011-10-14 16:28:02 +02:00
Jeremy Kemper
8cbe826958 Rails 4 is just around the corner. Stuck with 1.8 until then. 2011-10-13 16:11:00 -07:00
Jeremy Kemper
0a9b6de4d2 Tests gotta run in 1.8 too 2011-10-13 15:54:53 -07:00
David Heinemeier Hansson
85b64f98d1 Added ActiveRecord::Base.store for declaring simple single-column key/value stores [DHH] 2011-10-13 16:24:22 -05:00
Arun Agrawal
af7eeaafdb ambiguous first argument; put parentheses or even spaces Warning removed! 2011-10-10 14:16:45 +05:30
Jon Leighton
3456ef1119 Use broken YAML that will fail with Syck as well as Psych. Fixes test_broken_yaml_exception in fixtures_test.rb on Ruby 1.8.7.
Cherry-pick from 3-1-stable: b8d46924e7
2011-10-09 16:47:53 -07:00
Jeremy Kemper
8dba127188 Remove stray whitespace 2011-10-09 14:21:12 -07:00
Joseph Palermo
c90e5ce779 Only use LOWER for mysql case insensitive uniqueness check when column has a case sensitive collation. 2011-10-09 13:14:07 -07:00
Arun Agrawal
34d950b066 Fixed BodyProxy.new for tests! for wrong argument 2011-10-08 10:01:58 +05:30
Aaron Patterson
3088d23647 Merge pull request #3232 from Juanmcuello/pg_prepared_statements
Use the schema_search_path in prepared statements.
2011-10-06 20:08:05 -07:00
Jeremy Kemper
999b7ed94d Transactional fixtures enlist all active database connections.
You can use multiple databases in your tests without disabling transactional fixtures.
2011-10-05 19:10:18 -07:00
Jon Leighton
2e9e647fee 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:21:21 +01:00
Jon Leighton
64747654ca Revert "Raise error on unknown primary key."
This reverts commit ee2be435b1.
2011-10-05 20:21:21 +01:00
Juan M. Cuello
ac659b8ed3 refs #3232. Prepared statements and postgreSQL schemas.
Add tests for prepared statements with multiple schemas in
postgreSQL.
2011-10-05 14:44:50 -03:00
Jon Leighton
ee2be435b1 Raise error on unknown primary key.
If we don't have a primary key when we ask for it, it's better to fail
fast. Fixes GH #2307.
2011-10-05 01:11:40 +01:00
Yasuo Honda
b564ffcad4 To support ActiveRecord unit tests for IBM DB2 2011-10-02 22:51:01 -04:00
Jon Leighton
adb8ac153f Don't call self.class unless necessary. Closes #3171. 2011-09-29 18:00:30 +01:00
Rocky Jaiswal
aefc40324d Fixed failed test under 1.8.7 as map.keys order in indeterminable 2011-09-28 11:57:34 +05:30
Jon Leighton
b3407c86cf Don't require a DB connection when setting primary key.
Closes #2807.
2011-09-26 18:15:09 +01:00
Jon Leighton
89e98e278a Merge pull request #3030 from htanata/fix_habtm_select_query_method
Fix: habtm doesn't respect select query method
2011-09-26 16:52:23 +01:00
Jon Leighton
3b87c38d02 Fix belongs_to polymorphic with custom primary key on target.
Closes #3104.
2011-09-26 15:42:34 +01:00
Jon Leighton
b838059817 CollectionProxy#replace should change the DB records rather than just mutating the array. Fixes #3020. 2011-09-26 10:41:58 +01:00
Arun Agrawal
d589d9f160 fix test error when running with postgresql.
This Sqlite3 should be in if block.
Was giving error because sqlite3 is not loaded
2011-09-18 23:20:09 +05:30
Arun Agrawal
afa78fe327 Fixed test for JRuby.
for Sqlite3 in AR-JDBC.It's Jdbc::SQLite3::VERSION
2011-09-18 00:23:48 +05:30
Jon Leighton
3b8a7cf2a7 Stop trying to be clever about when to define attribute methods.
There is no meaningful performance penalty in defining attribute
methods, since it only happens once.

There is also no reason *not* to define them, since they get thrown in
an included module, so they will not 'overwrite' anything. In fact, this
is desirable, since it allows us to call super.
2011-09-14 00:00:37 +01:00
Jon Leighton
11870117c6 Rename first_or_new to first_or_initialize.
For consistency with find_or_initialize_by. Also remove first_or_build
alias.
2011-09-13 19:09:01 +01:00
Jon Leighton
1a421ceccb Deprecate using method_missing for attributes that are columns.
This shouldn't ever happen unless people are doing something
particularly weird, but adding a deprecation in case there are bugs not
caught by our tests.
2011-09-13 00:03:09 +01:00
Jon Leighton
ac687ed651 Let Ruby deal with method visibility.
Check respond_to_without_attributes? in method_missing. If there is any
method that responds (even private), let super handle it and raise
NoMethodError if necessary.
2011-09-13 00:01:58 +01:00
Jon Leighton
cf115d2f8e Reset column info when messing with columns.
We are subclassing Session here, but messing with the columns will
affect the attribute methods defined on the Session superclass, and
therefore other tests, unless we properly isolate it by resetting column
info before and after the test run.
2011-09-13 00:01:58 +01:00
Jon Leighton
eecfa84a90 Always generate attribute methods on the base class.
This fixes a situation I encountered where a subclass would cache the
name of a generated attribute method in @_defined_class_methods. Then,
when the superclass has it's attribute methods undefined, the subclass
would always have to dispatch through method_missing, because the
presence of the attribute in @_defined_class_methods would mean that it
is never generated again, even if undefine_attribute_methods is called
on the subclass.

There various other confusing edge cases like this. STI classes share
columns, so let's just keep all the attribute method generation state
isolated to the base class.
2011-09-13 00:01:58 +01:00
Jon Leighton
50d395f96e Raise error when using write_attribute with a non-existent attribute.
Previously we would just silently write the attribute. This can lead to
subtle bugs (for example, see the change in AutosaveAssociation where a
through association would wrongly gain an attribute.

Also, ensuring that we never gain any new attributes after
initialization will allow me to reduce our dependence on method_missing.
2011-09-13 00:01:58 +01:00
Jon Leighton
8667d3aeb6 Make protected method public so we avoid method_missing. 2011-09-13 00:01:58 +01:00
Arun Agrawal
fb73be8469 Not used variables removed. Warnings removed. 2011-09-10 09:38:57 +05:30
Guillermo Iguaran
b7f1735fea Add missing require in base_test.rb, fixes isolated test 2011-09-09 12:46:06 -05:00
Jon Leighton
cbf1dc7842 Merge pull request #2757 from andmej/first_or_create_pull_request
Add first_or_create family of methods to Active Record
2011-09-08 15:07:23 -07:00
Aaron Patterson
e1b500ec96 LRU cache in mysql and sqlite are now per-process caches. 2011-09-07 15:26:47 -07:00
Aaron Patterson
e6adeaa2fa fixing file name 2011-09-07 15:26:47 -07:00
Aaron Patterson
834d429e84 LRU should cache per process in postgresql. fixes #1339 2011-09-07 15:26:47 -07:00
Aaron Patterson
f5ea24b3db Merge commit 'refs/pull/2909/head' of https://github.com/rails/rails into rawr
* https://github.com/rails/rails:
  Postgresql adapter: added current_schema check for table_exists?
  Postgresql adapter: added current_schema check for table_exists?
2011-09-07 10:44:50 -07:00
Yasuo Honda
3937d443d6 Add ROWNUM to test first and last to support Oracle. 2011-09-07 07:40:55 -04:00
Jon Leighton
143769051b Don't include any of includes, preload, joins, eager_load in the through association scope. 2011-09-07 09:27:41 +01:00