Paul Gillard
6361d4234c
Call initialize_copy when cloning [ #3164 state:resolved]
...
Cloned AR objects are now instantiated through initialize_copy rather than
new/initialize. This allows AR classes to override initialize_copy in order to
implement deep cloning.
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-10-06 16:25:51 -05:00
Luciano G Panaro
4168f87623
Make has_one with :conditions hash scope build or creation of the associated object with those conditions
...
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#3088 state:committed]
2009-09-28 14:50:33 +13:00
Justin Bailey
c9d3c48dc6
Enable use of MySQL stored procedures by default.
...
[#3204 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-09-17 10:57:03 -07:00
Eloy Duran
26639e8a45
Removed the version of ActiveRecord::Base#destroyed? that was added in a44a1257d879311d88c2d10c366ab0d6561f903a.
...
Because José Valim was cheeky enough to already add it to the master branch.
2009-09-12 16:16:48 +02:00
Alexey Kovyrin
938c0ee045
Define autosave association validation methods only when needed. [ #3161 state:resolved]
...
Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
2009-09-12 16:04:36 +02:00
Eloy Duran
65f98951ac
During autosave, ignore records that already have been destroyed. [ #2537 state:resolved]
2009-09-12 16:04:07 +02:00
Graeme Porteous
c01be9de32
Fix has_one with foreign_key and primary_key association bug which caused the associated object being lost when saving the owner. [ #1756 state:resolved]
...
Mixed in a bit from patch by ransom-briggs. [#2813 state:resolved]
Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
2009-09-12 16:03:32 +02:00
José Valim
3091252aba
Rename nested attributes _delete to _destroy to reflect its actual behavior and DSL (:allow_destroy). Deprecation warning added. [ #2889 state:resolved]
...
Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
2009-09-12 15:59:32 +02:00
Dmitry Polushkin
845f62f473
Fix autosave association to skip validation if it is marked for destruction. [ #2064 state:resolved]
...
Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
2009-09-12 15:56:01 +02:00
Eloy Duran
6cc0b9638f
Explicitely setting `autosave => false' should override new_record autosaving. [ #2214 state:resolved]
...
Original author is Jacob.
2009-09-12 15:53:15 +02:00
Lance Ivy
a44a1257d8
Don't cascade autosave validation to destroyed children. [ #2761 state:resolved]
...
Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
2009-09-12 15:40:45 +02:00
Mike Breen
bcd0ef710e
Raise an exception with friendlier error message when attempting to build a polymorphic belongs_to with accepts_nested_attributes_for. [ #2318 state:resolved]
...
Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
2009-09-12 15:37:54 +02:00
Akira Matsuda
68b2b730e4
Fix default_error_messages back to the original message
...
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-09-11 18:34:12 -07:00
José Valim
2ea1d684d9
Refactor new callbacks and AR implementation.
...
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-09-08 10:26:39 -05:00
José Valim
4f37b97033
Changed ActiveRecord to use new callbacks and speed up observers by only notifying events that are actually being consumed.
...
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-09-08 10:26:39 -05:00
Jeremy Kemper
3b6a9a020e
Revert "Assert primary key does not exist in habtm when the association is defined, instead of doing that everytime a record is inserted."
...
Test failures on PostgreSQL.
[#3128 state:open]
This reverts commit da636809daca9c338200811d3590e446f57c8e81.
2009-09-02 13:55:47 -07:00
Jeffrey Hardy
41b3c912b7
Remove ClassInheritableAttributes test case, already covered by ActiveSupport [ #3114 state:resolved]
...
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-09-02 11:21:20 -05:00
José Valim
da636809da
Assert primary key does not exist in habtm when the association is defined, instead of doing that everytime a record is inserted.
...
[#3128 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-09-01 10:15:23 -07:00
Josh Sharpe
80989437dc
I added this feature so that a Map of changed fields could be retrieved
...
after a model had been saved. This is useful in the after_save callback
when you need to know what fields changed. At present there is no way
to do this other than have code in the before_save callback that takes
a copy of the changes Map, which I thought was a bit messy.
Example.
person = Person.find_by_name('bob')
person.name = 'robert'
person.changes # => {'name' => ['bob, 'robert']}
person.save
person.changes # => {}
person.previous_changes # => {'name' => ['bob, 'robert']}
person.reload
person.previous_changes # => {}
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-08-31 12:50:27 -05:00
Sven Fuchs
d672a14ee7
allow ActiveRecord#RecordInvalid exception message to be localized
...
[#2754 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-26 11:29:16 -07:00
Pratik Naik
25e5b0c4a8
Remove support for SQLite 2.
...
If you're still using it, please install the plugin from git://github.com/rails/sqlite2_adapter.git
2009-08-17 14:54:34 +01:00
Jay Pignata
7213da37ce
Fix test_has_many_through_polymorphic_has_one on sqlite2 [ #3054 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-15 19:14:32 -07:00
Pratik Naik
0a558b36eb
Add tests for hm:t#push failures
2009-08-11 02:37:04 +01:00
Pratik Naik
d0f891ae02
Rewrite hm:t#create tests using assert_no_difference and assert_difference
2009-08-10 21:30:44 +01:00
Arthur Zapparoli
55b5cf586a
Fixed typo in test name and CHANGELOG [ #3017 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-10 16:13:18 +01:00
Cristi Balan
3e35ba2481
Add tests for scoping schema_migrations index by global table prefix and suffix
...
[#1543 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 22:59:04 -07:00
Leonardo Borges
0c391b46fb
PostgreSQL: XML datatype support
...
[#1874 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 22:24:54 -07:00
Jaime Bellmyer
9c1bac0b7f
raises an exception on habtm join table inserts if join table contains a primary key. Caches this check to save time on subsequent inserts.
...
[#2086 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 22:19:18 -07:00
Jaime Bellmyer
f0602214e0
raises exception (ActiveRecord::ConfigurationError with message) on habtm association creation if join table contains a primary key
...
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 22:17:39 -07:00
Morgan Schweers
d2d464e26e
Fix that creating a table whose primary key prefix type is :table_name generates an incorrectly pluralized primary key.
...
[#872 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 21:57:56 -07:00
Jeremy Kemper
47f7c936a2
Fix test dependency on taggings
2009-08-09 21:30:55 -07:00
Gabe da Silveira
7e3364ac46
Fix that counter_cache breaks with has_many :dependent => :nullify.
...
[#1196 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 21:18:16 -07:00
Jatinder Singh
5704ecffad
AR should respect default values for MySQL BINARY and VARBINARY columns.
...
[#1273 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 21:05:26 -07:00
railsbob
e06a0b03c8
has_many :through create should not raise validation errors
...
[#2934 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 18:44:45 -07:00
Tristan Dunn
a0f69722be
Allow ho:through#build when the owner is a new record [ #1749 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-10 00:46:16 +01:00
Tristan Dunn
0472839d68
Prevent overwriting of table name in merging SQL conditions [ #2949 state:resolved]
2009-08-10 00:41:36 +01:00
Gabe da Silveira
00d6c76660
Enable has_many :through for going through a has_one association on the join model [ #2719 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-10 00:30:44 +01:00
Arthur Zapparoli
810b59a2a9
Removed duplicated tests [ #3026 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-10 00:08:40 +01:00
Arthur Zapparoli
ce2422ceaf
Model#human_attribute_name now accept symbols [ #3025 status:resolved]
...
Signed-off-by: José Valim <jose.valim@gmail.com>
2009-08-09 23:55:54 +01:00
Vladimir Meremyanin
08ec22054f
Make sure association conditions work with :include and :joins [ #358 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-09 23:10:23 +01:00
Tristan Dunn
1af9bd58a0
No longer require database name for MySQL to allow cross database selects.
...
[#1122 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 14:35:57 -07:00
Joshua Nichols
0ec64bea92
Added back support for destroying an association's object by id. [ #2306 status:resolved]
...
Signed-off-by: José Valim <jose.valim@gmail.com>
2009-08-09 21:46:52 +01:00
Hugo Peixoto
870750ed4b
With multiparameter date attributes, the behaviour when empty fields are present is now coherent with the one described in the date_select documentation.
...
[#1715 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 13:39:47 -07:00
Elise Huard
c5896bfd84
validate uniqueness with limit in utf8
...
[#2653 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 12:50:04 -07:00
Jeremy Kemper
db42f1bf67
Fix standalone test missing developer fixture
2009-08-09 11:58:07 -07:00
Hugo Peixoto
ff60ec469f
Added a uniqueness validation test that uses diacritics.
...
[#2883 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 11:51:58 -07:00
railsbob
076ca48bd6
Ensure hm:t#find does not assign nil to :include [ #1845 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-09 17:02:19 +01:00
Mike Breen
7d254b5d74
Serialized attributes should only be saved with partial_updates when the serialized attribute is present [ #2397 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-09 16:34:53 +01:00
Dmitry Ratnikov
314ba0433f
Changed to use klass instead of constantizing in assign_ids generated method
...
[#260 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 02:52:06 -07:00
Dmitry Ratnikov
f16008afdd
Modified Rich Bradley's test-case to fail as part of suite and with a reasonable message
...
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 02:40:27 -07:00