Eloy Duran
ec8f045844
Add support for nested object forms to ActiveRecord and the helpers in ActionPack
...
Signed-Off-By: Michael Koziarski <michael@koziarski.com >
[#1202 state:committed]
2009-02-01 14:44:30 +13:00
Jacob Dunphy
e6493eb9b7
Sqlite adapter's copy_table incorrectly attempts to recreate a primary key id (:id => true in the create_table) if an :id column is present, even if it isn't a primary_key.
...
This fix sets :id => false if there is an :id column, but it's not the primary_key.
Signed-off-by: Michael Koziarski <michael@koziarski.com >
[#1766 state:committed]
2009-01-29 17:34:33 +13:00
Filip H.F. "FiXato" Slagter
a0d8202bb9
Ensure whitespaces are stripped when merging string joins. [ #1297 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com >
2009-01-28 19:50:55 +00:00
Pratik Naik
74871961ec
Add array id support to Model.update_counters. [ #1254 state:resolved] [Carlos Júnior]
2009-01-28 19:20:55 +00:00
Dov Murik
5fe6635e05
Mysql#reconnect is set according to the 'reconnect' key in the connection spec.
...
The 'reconenct' boolean option is read from the connection specification
and is used to set the reconnect attribute of Mysql. The default is
false in order not to change existing application behaviour.
Also, reconnect is set AFTER real_connect is called, so its value sticks
(the mysql gem sets reconnect to false inside real_connect).
Signed-off-by: Michael Koziarski <michael@koziarski.com >
[#1797 state:committed]
2009-01-27 09:55:25 +13:00
Stephen Bannasch
4ef9845aa3
Adding AR tests for JDBC connections
...
New connections:
jdbcmysql jdbcpostgresql jdbcsqlite3 jdbcderby jdbch2 jdbchsqldb jdbcpostgresql
To test you will need the native database installed (if one is required),
activerecord-jdbc-adapter and the specific activerecord-jdbc<database>-adapter
for the database you are testing.
Run the tests like this:
jruby -S rake test_jdbcmysql
Signed-off-by: Michael Koziarski <michael@koziarski.com >
[#1685 state:committed]
2009-01-26 16:08:44 +13:00
Pratik Naik
fe6ffce51d
Make sure inner scope conditions get a preference over the outer ones
2009-01-24 17:54:10 +00:00
Pratik Naik
3b1cd9e525
Fix has_and_belongs_to_many_associations tests. #1738
2009-01-18 00:34:57 +00:00
lukeludwig
3ee4e00918
Cache columns for has_and_belongs_to_many associations
...
This avoids repeatedly calling SHOW COLUMNS when the association is queried
[#1738 state:committed]
2009-01-17 18:09:13 +13:00
Carlos Kozuszko
5ed119c005
Fix dirty handling of nullable non-integer numeric columns [ #1692 state:resolved]
...
Signed-off-by: Frederick Cheung <frederick.cheung@gmail.com >
2009-01-16 17:23:35 +00:00
Ben VandenBos
0e92f67073
Make belongs_to :dependent => :destroy destroy self before associated object [ #1079 state:resolved]
...
If foreign key constraints are in place then deleteing the associated object first will cause a foreign key violation
Signed-off-by: Frederick Cheung <frederick.cheung@gmail.com >
2009-01-16 17:23:19 +00:00
Michael Koziarski
f2ee3f20df
Fix the AR json serialization tests to comply with the earlier change to quote keys correctly
2009-01-16 17:57:45 +13:00
Michael Lovitt
7a0e7c7270
Fixed broken after_save callback; was being called when before_create was canceled or before_update was canceled
...
Signed-off-by: Michael Koziarski <michael@koziarski.com >
[#1735 state:committed]
2009-01-16 10:11:58 +13:00
Carlos Kozuszko
c891d685de
Fixing bug on ActiveRecord::Dirty#field_changed? for nullable numeric columns, NULL gets stored in database for blank (i.e. '') values. Only integer columns were considered.
...
Signed-off-by: Michael Koziarski <michael@koziarski.com >
[#1692 state:committed]
2009-01-16 10:00:39 +13:00
Hongli Lai (Phusion)
9bcf01b23c
Fix PostgreSQL unit test failures that only occur when using the old 'postgres' driver.
...
[#1748 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2009-01-13 15:58:50 -08:00
Jeremy Kemper
ab0ce052ba
Introduce transaction_joinable flag to mark that the fixtures transaction can't joined, a new savepoint is required even if :requires_new is not set. Use :requires_new option instead of :nest. Update changelog.
...
[#383 state:committed]
2009-01-10 13:39:37 -08:00
Jeremy Kemper
223a1d9451
Merge branch 'master' into savepoints
2009-01-10 12:14:44 -08:00
Pratik Naik
82443ecfad
Merge commit 'fred/pullable'
2008-12-30 17:50:17 +00:00
Mike Gunderloy
a29369ae4a
Fix named scope tests for sqlite3 [ #1667 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com >
2008-12-30 03:10:11 +00:00
Yaroslav Markin
66ee5890c5
Introduce dynamic scopes for ActiveRecord: you can now use class methods like scoped_by_user_name(user_name) and scoped_by_user_name_and_password(user_name, password) that will use the scoped method with attributes you supply. [ #1648 state:committed]
...
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com >
2008-12-28 20:52:46 +01:00
Yaroslav Markin
6e98adfc8e
ActiveRecord::Base#new_record? now returns false for existing records (was nil) [ #1219 state:committed]
...
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com >
2008-12-27 14:36:11 +01:00
Roman Shterenzon
21efba464a
Fix HasManyAssociation#create ignoring the :primary_key option [ #1633 state:resolved]
...
Signed-off-by: Frederick Cheung <frederick.cheung@gmail.com >
2008-12-27 01:10:29 +00:00
Frederick Cheung
f9cab0e503
Fix :include of has_one with :primary_key option
2008-12-26 23:26:37 +00:00
Frederick Cheung
7db1704068
Fix :include of has_many associations with :primary_key option
2008-12-26 23:17:56 +00:00
Frederick Cheung
5cebe69e74
Preload uses exclusive scope [ #643 state:resolved]
...
With self referential associations, the scope for the the top level should not affect fetching of associations, for example
when doing
Person.male.find :all, :include => :friends
we should load all of the friends for each male, not just the male friends.
2008-12-26 18:25:55 +00:00
Pivotal Labs
eb457ceee1
Association preloading no longer stops if it hits a nil object [ #1630 state:resolved]
...
Signed-off-by: Frederick Cheung <frederick.cheung@gmail.com >
2008-12-26 18:25:50 +00:00
Luis Hurtado
63aac33833
Ensure of Model#create support custom updated_at and updated_on attributes [ #1612 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com >
2008-12-22 15:19:33 +00:00
Daniel Luz
f7bd0beb67
Ensure Model#last doesn't affects order for another finders inside the same scope [ #1499 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com >
2008-12-21 23:24:06 +00:00
Frederick Cheung
b17b9371c6
Fix configure_dependency_for_has_many not quoting conditions properly [ #1461 state:resolved]
2008-12-21 15:57:48 +00:00
Frederick Cheung
6f4b2469fb
Use explicit order to stop test failing randomly
2008-12-21 15:57:21 +00:00
Karthik Krishnan
75a133f92f
Fix has many through not quoting table names [ #1163 state:resolved]
...
Signed-off-by: Frederick Cheung <frederick.cheung@gmail.com >
2008-12-20 21:08:51 +00:00
Emilio Tagua
c092dbef50
Add missing fixture to allow reload models test to run isolated [ #1609 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com >
2008-12-20 20:39:25 +00:00
Pratik Naik
89b7581404
Add repair_helper.rb file I forgot in previous commit 8a92cd
2008-12-19 13:52:21 +00:00
Murray Steele
8a92cdc863
Add a repair_helper to repair changes to the validations inside validations_test.rb [ #674 state:resolved]
...
Many of the tests in validations_test would add a new validation to
models. However, only Topic was being reset with a fairly aggressive
clearing of all validations. None of the other models being used however
were recieving the same treatment. Now we use repair_validations(Topic)
for the whole test case because most test cases use Topic and then the
block form of repair_validations(<other_models>) inside any tests that use
other models.
Signed-off-by: Pratik Naik <pratiknaik@gmail.com >
2008-12-19 13:37:50 +00:00
Matt Jones
a9422cc1db
Fix preloading of has_one :through associations on belongs_to [ #1507 state:resolved]
...
Signed-off-by: Frederick Cheung <frederick.cheung@gmail.com >
2008-12-18 19:19:36 +00:00
Frederick Cheung
c9ab7098be
Ensure :include checks joins when determining if it can preload [ #528 state:resolved]
2008-12-18 19:19:36 +00:00
Emilio Tagua
9cf6b1b15e
Add missing model files so tests can run isolated [ #1506 state:resolved]
...
Signed-off-by: Frederick Cheung <frederick.cheung@gmail.com >
2008-12-18 19:19:36 +00:00
Frederick Cheung
707d0dd3e1
Fix preloading of belongs_to with null foreign key generating useless query [ #1027 state:resolved]
2008-12-18 19:19:35 +00:00
Hongli Lai (Phusion)
a392f34fb4
Require mocha >= 0.9.3, older versions don't work anymore [ #1579 state:resolved]
...
Signed-off-by: Joshua Peek <josh@joshpeek.com >
2008-12-15 14:47:19 -06:00
Jeremy Kemper
d45e2c733d
Merge branch 'master' of git@github.com:rails/rails
2008-12-10 14:53:18 -08:00
Jeremy Kemper
b30ae19748
Revert "Fix: counter_cache should decrement on deleting associated records."
...
[#1196 state:open]
This reverts commit 05f2183747 .
2008-12-10 14:48:12 -08:00
Bruce Krysiak
aa5cdb0d47
Added a :camelize option to ActiveRecord and Hash to_xml serialization and from_xml deserialization
...
Signed-off-by: Michael Koziarski <michael@koziarski.com >
2008-12-10 20:28:05 +01:00
Emilio Tagua
96b815d7e8
Fix test names collision.
...
[#1549 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2008-12-10 11:10:22 -08:00
Emilio Tagua
05f2183747
Fix: counter_cache should decrement on deleting associated records.
...
[#1195 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2008-12-10 10:59:52 -08:00
Frederick Cheung
355f41d8aa
Rework ActiveSupport::OrderedHash to make lookups faster
...
[#1352 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2008-12-10 09:07:47 -08:00
Hongli Lai (Phusion)
13c6c3cfc5
Merge commit 'origin/master' into savepoints
2008-12-09 01:38:17 +01:00
Ben Symonds
091e6f791a
Change field_changed? method to handle the case where a nullable integer column is changed from 0 to '0'
...
[#1530 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2008-12-08 15:42:13 -08:00
Hongli Lai (Phusion)
ccb96f2297
Merge commit 'origin/master' into savepoints
...
Conflicts:
activerecord/lib/active_record/fixtures.rb
activerecord/test/cases/defaults_test.rb
2008-12-03 19:30:35 +01:00
miloops
97403ad5fd
Add :having option to find, to use in combination with grouped finds. Also added to has_many and has_and_belongs_to_many associations.
...
Signed-off-by: Michael Koziarski <michael@koziarski.com >
[#1028 state:committed]
2008-12-01 20:22:31 +01:00
Paul
9a4d557713
Ensure hash conditions on referenced tables are considered when eager loading with limit/offset. [ #1404 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com >
2008-11-26 15:25:39 +01:00