Wolfram Arnold
73f2d37505
Add test to verify that the new :inverse_of association option will indeed fix the validation problem for a belongs_to relationship that validates_presence_of the parent, when both the parent and the child are new (in-memory) records. Also check that this works when the parents adds child via nested_attributes_for.
...
Lastly, add a require 'models/pet' to association_validation_test.rb, so that test can be run independently (was failing due to that missing dependency). [#2815 status:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com >
2009-08-08 13:07:49 +02:00
Josh Sharpe
54e7f5ba43
Tidy up the AR tests, removing duplicates and making tests clearer / more focussed.
...
Signed-off-by: Michael Koziarski <michael@koziarski.com >
[#2774 state:committed]
2009-08-08 14:53:35 +12:00
Jeremy Kemper
019ed5a7c0
Don't rely on T::U::TestCase#name
2009-08-07 17:04:19 -07:00
Jeremy Kemper
482a6f716f
Ruby 1.9.2: Object#id is gone now
2009-08-07 16:41:04 -07:00
Jeremy Kemper
06afa48c8c
Merge branch 'oracle_enhanced'
2009-08-07 11:58:45 -07:00
José Valim
7034272354
Add destroyed? to ActiveRecord, include tests for polymorphic urls for destroyed objects and refactor mime responds tests and documentation.
2009-08-07 17:16:16 +02:00
Raimonds Simanovskis
5f0c425e8d
Some databases (e.g. Oracle) does not allow "AS" between table name and table alias name, for others it is optional
2009-08-06 23:41:00 +03:00
Raimonds Simanovskis
53be10c5e6
fixed test_foreign_key_violations_are_translated_to_specific_exception to work with Oracle
2009-08-06 23:41:00 +03:00
Raimonds Simanovskis
44a7ef85eb
modifications to Oracle connection.rb setup
2009-08-06 23:41:00 +03:00
Raimonds Simanovskis
9b2309c4a8
fix schema_dumper_test for Oracle as it supports precision up to 38
2009-08-06 23:41:00 +03:00
Raimonds Simanovskis
94e761551b
changed default connection to localhost orcl database
2009-08-06 23:41:00 +03:00
Raimonds Simanovskis
8afab34a76
always sort lists by id before comparison to avoid errors because of different sorting of same results (on Oracle database)
2009-08-06 23:41:00 +03:00
Raimonds Simanovskis
8f34c96614
support for assert_queries when using Oracle adapter
...
initialize $KCODE to UTF8 when JRuby is used
2009-08-06 23:41:00 +03:00
Raimonds Simanovskis
090ec47bec
added Subject#after_initialize to be the same as Topic#after_initialize
2009-08-06 23:41:00 +03:00
Raimonds Simanovskis
01a4e07c36
Oracle can store integers with any :limit
2009-08-06 23:41:00 +03:00
Raimonds Simanovskis
04e6bc1134
Oracle adapter recourns count() as numeric (not string)
2009-08-06 23:40:59 +03:00
Raimonds Simanovskis
5d0dece6a6
Oracle adapter gets Time or DateTime value already with timezone
2009-08-06 23:40:59 +03:00
Raimonds Simanovskis
ee654e54c4
Oracle generates different ORDER BY fragment
2009-08-06 23:40:59 +03:00
Raimonds Simanovskis
3a1cbc5c3b
Oracle adapter returns Time value for DATE columns
2009-08-06 23:40:59 +03:00
Raimonds Simanovskis
42fd2a3b16
added :order to find :all as otherwise Oracle tests were failing
2009-08-06 23:40:59 +03:00
Raimonds Simanovskis
c3e1ef0b40
Oracle needs sequence value for primary key in INSERT statement
2009-08-06 23:40:59 +03:00
Raimonds Simanovskis
a12358b3a5
Oracle adapter returns numeric (not string) value after SUM
2009-08-06 23:40:59 +03:00
Raimonds Simanovskis
d40e3ea936
Oracle saves empty string as NULL
2009-08-06 23:40:59 +03:00
Raimonds Simanovskis
71c32d3cac
1=2 is invalid expression in Oracle SELECT
2009-08-06 23:40:59 +03:00
Raimonds Simanovskis
5666a3ad06
added :order option to find :first methods and associations as otherwise Oracle tests were failing
...
Oracle stores '' string as NULL
Oracle cannot have identifiers larger than 30 characters
added missing fixtures to test setup method
2009-08-06 23:40:59 +03:00
Raimonds Simanovskis
963570b51c
added additional objects necessary for OracleAdapter specific tests
...
if OracleAdapter is used then use VARCHAR2(4000) instead of CLOB datatype as CLOB data type has many limitations in
Oracle SELECT WHERE clause which causes many unit test failures
2009-08-06 23:40:59 +03:00
Raimonds Simanovskis
04fea8a07b
modified native_oracle/connection.rb to run it with oracle_enhanced adapter
2009-08-06 23:40:58 +03:00
Rob Christie
7e560d0b0d
Fixed adapter test cases that were failing in oracle because the asserts were looking for the presence of offset and limit which are not available in oracle. Changed the tests to check that the sql injection is not present in the output so that the tests are database adapter agnostic.
2009-08-06 23:40:58 +03:00
Akira Matsuda
230d43fbf5
Ruby 1.9.2 compat: Array#* uses to_str instead of to_s to join values since Ruby 1.9.2
...
[#2959 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2009-08-05 17:08:02 -07:00
Geoff Buesing
bfafe8c405
Revert "fallback_string_to_date sets Date._parse comp arg to true, so that strings with two-digit years, e.g. '1/1/09', are interpreted as modern years" [ #2019 state:wontfix]
...
This reverts commit 55d1d12c32 .
2009-08-05 08:26:12 -05:00
Joshua Peek
f8d3c72c39
Extract generic attribute method generation to AMo
2009-08-04 23:36:05 -05:00
Joshua Peek
64eecdd131
whitespace
2009-08-04 16:28:44 -05:00
Paul Gillard
bada18dc36
Added reset_attribute! method to ActiveRecord::AttributeMethods::Dirty which will reset an attribute to its original value should it have changed.
...
Signed-off-by: Joshua Peek <josh@joshpeek.com >
2009-08-04 16:23:08 -05:00
Paul Gillard
c30a0ce3c8
Modified ActiveRecord::AttributeMethods to allow classes to specify attribute method prefixes and/or suffixes. Previously only suffixes were allowed.
...
Signed-off-by: Joshua Peek <josh@joshpeek.com >
2009-08-04 16:19:19 -05:00
Joshua Peek
aad5a30bf2
Add simple support for ActiveModel's StateMachine for ActiveRecord
2009-08-04 11:03:57 -05:00
Matt Ganderup
55d1d12c32
fallback_string_to_date sets Date._parse comp arg to true, so that strings with two-digit years, e.g. '1/1/09', are interpreted as modern years [ #2019 state:resolved]
2009-08-03 22:41:56 -05:00
Geoff Buesing
6f97ad07de
quoted_date converts time-like objects to ActiveRecord::Base.default_timezone before serialization. This allows you to use Time.now in find conditions and have it correctly be serialized as the current time in UTC when default_timezone == :utc [ #2946 state:resolved]
2009-08-03 22:03:47 -05:00
Joshua Peek
9b68877897
Track generated attribute methods in a separate module
2009-08-02 21:06:35 -05:00
Jeremy Kemper
cdf60e46cc
SQLite: drop support for 'dbfile' option in favor of 'database.'
2009-08-01 18:22:12 -07:00
Joshua Peek
62fd1d3716
Start separating primary key concerns
2009-07-30 17:54:02 -05:00
Joshua Peek
ded3d97c5a
Make sure we use send for the default attribute method body because the suffix maybe an invalid method name
2009-07-30 17:54:02 -05:00
Joshua Peek
1ae7eb5200
Make sure to reset defined methods after calling attribute_method_suffix
2009-07-30 17:54:02 -05:00
Joshua Peek
d599ea27c5
Move attribute_types_cached_by_default into attribute methods reading concern
2009-07-30 17:54:02 -05:00
Joshua Peek
89e9efcbe2
Don't need to pass attr_name to evaluate_attribute_method anymore
2009-07-30 17:54:01 -05:00
Joshua Peek
2c30c9fe6c
Undefine id and let it automatically be generated
2009-07-30 17:54:01 -05:00
Joshua Peek
f8d2c77c90
Redirect method missing for primary key to read_attribute
2009-07-30 17:54:01 -05:00
Joshua Peek
9cdcfb4fc5
ditto for id=
2009-07-30 17:54:01 -05:00
Joshua Peek
831c38ffc7
Don't define id_before_type_cast, just let it be generated on its own
2009-07-30 17:54:01 -05:00
Joshua Peek
1841fd54e6
Move id attribute methods into their related concern
2009-07-30 17:54:01 -05:00
Joshua Peek
3e58f8e191
Restore DangerousAttributeError
2009-07-30 17:54:00 -05:00