Jeremy Kemper
4cbd3f050b
Move from git submodule to gem bundle
2009-10-14 17:19:24 -07:00
Emilio Tagua
991d1bc200
Merge commit 'rails/master'
2009-10-13 15:06:43 -03:00
Pratik Naik
68d416a58f
Add a :limit option to specify the maximum number of records that can be processed by accepts_nested_attributes_for
2009-10-09 16:08:11 +01:00
Pratik Naik
e94caf0788
Store entire options hash in the class var rather than just the reject_if proc for the nested attributes
2009-10-09 15:47:10 +01:00
Emilio Tagua
0cf4662ec5
Merge commit 'rails/master'
2009-10-08 15:05:18 -03:00
Pratik Naik
0c27d0886e
Use indifferent access attributes instead of stringifying them
2009-10-08 00:15:36 +01:00
Pratik Naik
572323135f
Allow accepts_nested_attributes_for :reject_if option accept symbols for using a method
...
Conflicts:
activerecord/lib/active_record/nested_attributes.rb
2009-10-07 23:50:30 +01:00
Emilio Tagua
9a958a3d7d
Relations: Added offset when finding with associations. Delegate array instance
...
methods to to_a.
2009-10-07 12:43:04 -03:00
Emilio Tagua
aadb09b13b
Merge commit 'rails/master'
2009-10-07 12:23:23 -03:00
Emilio Tagua
1d5854826b
Allow preload and eager_load to work on relations at the same time.
2009-10-07 11:57:59 -03:00
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
Emilio Tagua
1daceeb838
Merge branch 'associations_2'
2009-10-05 15:25:06 -03:00
Emilio Tagua
65f055a3ed
Added eager loading support to Relation and ActiveRecord#all.
2009-10-05 15:24:08 -03:00
Emilio Tagua
3747f896a1
Moved relation's test to relation_test.
2009-10-05 14:39:20 -03:00
Emilio Tagua
29457a21c0
Merge commit 'rails/master'
2009-10-02 10:52:55 -03: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
Emilio Tagua
a294d8362b
Merge commit 'rails/master'
2009-09-21 14:57:24 -03: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
Emilio Tagua
24260dc0c8
Merge commit 'rails/master'
2009-09-14 09:47:55 -03: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
Emilio Tagua
0489f0c582
Merge commit 'rails/master'
2009-09-08 15:39:33 -03:00
Emilio Tagua
670281c6b2
Merge commit 'rails/master'
...
Conflicts:
activerecord/lib/active_record/associations.rb
2009-09-08 15:38:51 -03: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
Emilio Tagua
39e4e76d15
Merge commit 'rails/master'
...
Conflicts:
activerecord/lib/active_record/associations.rb
2009-09-01 15:45:43 -03:00
Emilio Tagua
c01c21b31d
Added association preload to relation.
2009-09-01 15:36:09 -03: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
Emilio Tagua
6b67df70ab
Revert "Revert "Add readonly support for relations.""
...
This reverts commit f2c0725d79e29b02e30e7a4827851acc4a766730.
2009-08-27 20:03:46 -03:00
Emilio Tagua
f2c0725d79
Revert "Add readonly support for relations."
...
This reverts commit 7cce95b25ace33e04526d4490e487a080c1f9b96.
2009-08-27 20:00:14 -03:00
Emilio Tagua
7cce95b25a
Add readonly support for relations.
2009-08-27 18:52:14 -03:00
Emilio Tagua
d395391e1d
Merge commit 'rails/master'
2009-08-27 15:56:16 -03: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
Emilio Tagua
74ed123e08
Override respond_to? in ActiveRecord::Relation to go with
...
method_missing.
2009-08-18 16:35:33 -03:00
Emilio Tagua
66fbcc1de6
Use immutable relation objects to generate queries.
2009-08-18 14:10:03 -03:00
Emilio Tagua
08f6af2d53
Fix typo in test classname.
2009-08-18 08:12:35 -03:00
Emilio Tagua
79e951ca9b
Use finder options as relation method names to provide more familiar
...
naming. Use bang methods convention in methods that alter the
relation.
2009-08-18 07:50:11 -03:00
Emilio Tagua
4b339f44bd
Merge commit 'rails/master'
2009-08-17 19:46:32 -03:00
Emilio Tagua
c01c8967a0
Merge commit 'rails/master'
...
Conflicts:
activerecord/lib/active_record/calculations.rb
2009-08-17 19:46:06 -03:00