Jeremy Kemper
b9f352316e
Ruby 1.9.2: exclude to_str from explicit coercion check too
2009-12-06 16:54:53 -08:00
Jeremy Kemper
64082b350c
Ruby 1.9.2: explicitly raise NoMethodError for attempts at explicit coercion
2009-12-06 16:46:01 -08:00
Gabe da Silveira
43d2cb8e93
Replace reset_counter_cache with reset_counters that has API inline with existing update_counters method
...
[#1211 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2009-12-03 23:25:41 -08:00
Ben Marini
ccb197b2e6
Add support for Mysql column positioning via #add_column and #change_column
...
add_column and change_column in the Mysql adapter now accept some
additional options:
:first => true # Put the column in front of all the columns
:after => column_name # Put the colmn after 'column_name'
add_column :new_col, :string, :first => true
add_column :another_col, :integer, :default => 0, :after => :new_col
[#3286 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2009-12-03 23:10:35 -08:00
Mat Brown
2f1ded3067
Fix instance_eval calls to association proxies
...
In the current stable, ActiveRecord::Associations::AssociationProxy#method_missing calls yield() if a block is given, causing the block to always be evaluated in its calling context. However, in the case of instance_eval, correct behavior requires that the block be passed directly to the @target, rather than being evaluated inside a different block. Incidentally, this also simplifies the code slightly.
[#3412 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2009-12-02 12:46:36 -08:00
Mike Breen
1db3a27961
Implement ActiveRecord#reset_counter_cache
...
[#1211 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2009-12-02 12:08:57 -08:00
Michael Koziarski
ec542caf58
Prepare for the 2.3.5 release
2009-11-25 18:56:12 +13:00
Gabe da Silveira
df0720b8b7
Insert generated association members in the same order they are specified when assigning to a has_many :through using the generated *_ids method
...
[#3491 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2009-11-17 22:24:53 -08:00
Jeremy Kemper
ed320cd896
Revert "Ensure Model#destroy respects optimistic locking"
...
Unresolved issues with :dependent => :destroy and counter caching.
[#1966 state:open]
This reverts commit 0d922885fb .
2009-11-17 15:31:02 -08:00
Jeremy Kemper
61bb491cbe
Ruby 1.9.2: use super rather than raise our own NoMethodError to work around to_ary issues
2009-11-13 13:03:10 -08:00
José Valim
a4540128a4
[PATCH] Optimize Error I18n to avoid unecessary lookups and just retrieve values when needed [ #3477 status:resolved].
...
Signed-off-by: Joshua Peek <josh@joshpeek.com >
2009-11-10 12:26:33 -06:00
Matt Jones
6c0028d5cc
delete correct records for a has_many with :primary_key and :dependent => :delete_all
...
Signed-off-by: Michael Koziarski <michael@koziarski.com >
2009-11-10 18:07:04 +13:00
Eloy Duran
6b2291f330
Define autosave association callbacks when using accepts_nested_attributes_for.
...
This way we don't define all the validation methods for all associations by
default, but only when needed.
[#3355 state:resolved]
2009-11-06 23:53:33 +01:00
José Valim
f5f7c40f3a
Fix nested attributes error messages which is broken in 2.3.4. It still copies the message from child to parent, but does the lookup in the child, not in the parent, avoiding error messages duplication (as happened in 2.3.3). [ #3147 state:resolved]
...
Signed-off-by: Joshua Peek <josh@joshpeek.com >
2009-10-28 13:44:24 -05:00
Pratik Naik
c23706b787
Add a :limit option to specify the maximum number of records that can be processed by accepts_nested_attributes_for
...
Conflicts:
activerecord/lib/active_record/nested_attributes.rb
2009-10-09 16:11:22 +01:00
Pratik Naik
4010b49de8
Store entire options hash in the class var rather than just the reject_if proc for the nested attributes
...
Conflicts:
activerecord/lib/active_record/nested_attributes.rb
activerecord/test/cases/nested_attributes_test.rb
2009-10-09 15:47:31 +01:00
Pratik Naik
a69316b293
Use indifferent access attributes instead of stringifying them
2009-10-08 00:14:52 +01:00
Pratik Naik
e2127991a1
Allow accepts_nested_attributes_for :reject_if option accept symbols for using a method
2009-10-07 23:45:40 +01:00
Chad Woolley
1901747001
reduce max size of fixture IDs to fix sqlite2 tests, because sqlite2 was getting negative and changing values for ID field. See http://www.sqlite.org/datatypes.html
...
Signed-off-by: Yehuda Katz <wycats@gmail.com >
2009-09-29 02:53:45 -07:00
Luciano G Panaro
14a6794a8e
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:51:14 +13:00
Justin Bailey
4f5cac53b7
Enable use of MySQL stored procedures by default.
...
[#3204 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2009-09-17 10:59:41 -07:00
sdsykes
8afeec20e0
Ruby 1.9 compat: corrected instance_methods check
...
[#3156 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2009-09-13 02:58:36 -07:00
Eloy Duran
2524ac84e6
Removed some superfluous conditionals from the autosave association validation methods.
...
Which are unneeded now that we only define them when needed.
2009-09-12 15:03:05 +02:00
Alexey Kovyrin
c0245493cb
Define autosave association validation methods only when needed. [ #3161 state:resolved]
...
Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com >
2009-09-12 14:55:34 +02:00
Eloy Duran
9290051b85
Added some documentation about setting :autosave => false on an association.
2009-09-12 13:43:17 +02:00
Eloy Duran
c665faac09
During autosave, ignore records that already have been destroyed. [ #2537 state:resolved]
2009-09-12 13:43:17 +02:00
Graeme Porteous
a070873771
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 13:43:16 +02:00
José Valim
11c338735c
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 13:36:42 +02:00
Dmitry Polushkin
c52a50ec51
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 13:36:42 +02:00
Eloy Duran
2420d6272c
Explicitely setting `autosave => false' should override new_record autosaving. [ #2214 state:resolved]
...
Original author is Jacob.
2009-09-12 13:23:05 +02:00
Lance Ivy
7c1e4ef64b
Don't cascade autosave validation to destroyed children. [ #2761 state:resolved]
...
Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com >
2009-09-12 13:16:30 +02:00
Mike Breen
52a50db6c0
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 13:16:30 +02:00
sdsykes
d48d3d0f41
Fix habtm associations when using multiple databases
...
[#3128 ]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2009-09-12 02:55:33 -07:00
Jeremy Kemper
08d15f86c4
Deprecate "Allow frameworks to be required by their gem name"
...
This has just been confusing. Better to educate than band-aid.
This deprecates commit 18a24274ec .
Originally from http://dev.rubyonrails.org/ticket/8845 [drnic]
2009-09-12 02:45:33 -07:00
Akira Matsuda
44fbc86ab8
Ensure validation errors to be ordered in declared order
...
[#2301 state:committed milestone:2.3.5]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2009-09-11 18:37:32 -07:00
Shugo Maeda
d2cf33e903
Removed the copyright notice not to show it in the result of 'ri ActiveRecord'.
2009-09-11 15:18:08 -07:00
José Valim
e1b109633c
Allow scope to be changed for ActiveRecord::Errors#generate_full_message and change deprecation message [ #1687 state:resolved]
...
Signed-off-by: Joshua Peek <josh@joshpeek.com >
2009-09-08 10:38:45 -05:00
Michael Koziarski
a43ef2436c
Prepare for 2.3.4 release
2009-09-04 09:56:09 +12:00
Jeremy Kemper
2b82708b0e
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 ]
This reverts commit 594a281d66 .
2009-09-02 13:57:33 -07:00
José Valim
594a281d66
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:18:47 -07:00
Sven Fuchs + Mateo Murphy
13fb26b714
Fix ActiveRecord Error message I18n:
...
* allow messages and full_messages to be lazily translated at any time
* allow locales to be swapped and still obtain correctly localized messages
* allow localized global and error-type specific full_message formats
* extract an Error class
[#1687 state:open]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2009-08-29 09:48:16 -07:00
Jeffrey Hardy
8a49183563
Don't use AR::Base.connection for fixture column quoting. Use the connection given to Fixtures.new
...
[#3104 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2009-08-26 14:53:32 -07:00
Sven Fuchs
a4838ee466
allow ActiveRecord#RecordInvalid exception message to be localized
...
[#2754 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2009-08-26 11:23:30 -07:00
Pratik Naik
b9f668ea94
Deprecate SQLite2Adapter and DeprecatedSQLiteAdapter
2009-08-17 14:49:31 +01:00
Jay Pignata
a249cad5ef
Fix calculation tests on sqlite2 [ #3053 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com >
2009-08-15 19:52:08 +01:00
Tim Peters
9e96f37edd
Use table prefix and suffix for schema_migrations index.
...
[#1543 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2009-08-09 22:57:37 -07:00
Leonardo Borges
5c74cffae6
PostgreSQL: XML datatype support
...
[#1874 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2009-08-09 22:26:26 -07:00
Jaime Bellmyer
9d51f62866
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:20:02 -07:00
Jaime Bellmyer
9a3a7983c3
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:19:56 -07:00
Morgan Schweers
d0bdff0799
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:59:08 -07:00