Commit Graph

193 Commits

Author SHA1 Message Date
Rhett Sutphin
d72c66532f Make fixture accessors work when fixture name is not same as the table name. [#124 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-07-14 02:01:52 +01:00
Daniel Guettler
84af99e78d Ensure NamedScope#build/create/create!/new works as expected when named scope has hash conditions. [Daniel Guettler, Pratik Naik] [#419 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-07-09 14:09:17 +01:00
Chris Cherry
124d1016fa Allow Infinity (1.0/0.0) to pass validates_numericality_of. [#354 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-07-09 13:15:07 +01:00
Brad Greenlee
afa0c7f728 Add support for :primary_key option to has_one as well as has_many so that a key other than the default primary key can be used for the association
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-07-06 20:25:10 +02:00
Andre Arko
3351d29970 Add has_many :primary_key option to allow setting the primary key on a has many association
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-07-06 20:25:10 +02:00
David Lowenfels
87fbcaa622 Add :tokenizer option to validates_length_of. [#507 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-07-04 01:31:39 +01:00
Pratik Naik
474d425382 Ensure AssociationCollection#size considers all unsaved record. [#305 state:resolved] [sds]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-07-02 03:17:33 +01:00
Tim Chater
1415df8f49 Dirty: recognize when an integer changes from zero to blank. [#433 state:resolved] 2008-06-27 21:31:06 -07:00
Pratik Naik
9a25315076 Add extra hash conditions tests for named_scope 2008-06-28 01:57:32 +01:00
Pratik Naik
cd994eff9a Allow conditions on multiple tables to be specified using hash.
Examples:

  User.all :joins => :items, :conditions => { :age => 10, :items => { :color => 'black' } }
  Item.first :conditions => { :items => { :color => 'red' } }

Note : Hash key in :conditions is referring to the actual table name or the alias defined in query.
2008-06-28 01:27:51 +01:00
Jeremy Kemper
4498aad4ac MySQL: treat integer with :limit => 11 as a display width, not byte size, for backward-compatibility. 2008-06-27 01:07:22 -07:00
Jan De Poorter
b2b761166d Make sure associated has_many/habtm objects get saved even when :validate => false is used. [#486 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-06-27 03:02:13 +01:00
Jeremy Kemper
f6520b7dc7 Test for tinyint 2008-06-23 23:42:06 -07:00
Tarmo Tänav
baddea95e1 Always treat integer :limit as byte length. [#420 state:resolved] 2008-06-22 20:42:31 -07:00
Daniel Morrison
3610997ba3 Partial updates don't update lock_version if nothing changed. [#426 state:resolved] 2008-06-22 20:33:43 -07:00
Mark Catley
0fd3e4cd2b Fix column collision with named_scope and :joins. [#46 state:resolved] 2008-06-22 19:21:15 -07:00
Michael Raidel
f94600bdaf ActiveRecord::Migrator#run records version-state after migrating. [#369 state:resolved] 2008-06-22 18:16:17 -07:00
Tarmo Tänav
1afae84ab2 Fixed that scopes defined with a string name could not be composed 2008-06-22 17:26:00 -07:00
Tarmo Tänav
509374ebe2 Named bind variables can now be used with postgresql-style typecasts
For example :conditions => ['stringcol::integer = :var', { :var => 10 }]
will no longer raise an exception about ':integer' having a missing value.
2008-06-22 16:16:06 -07:00
Diego Algorta
2e1b56c937 MySQL: rename_column preserves default values. [#466 state:resolved] 2008-06-22 15:21:11 -07:00
rick
10c581a6de fix merge 2008-06-19 09:59:36 -07:00
George Ogata
bc4a2f156b Fix observers that use after_find. [#375 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-06-17 19:45:18 +01:00
Jeremy Kemper
2275b8daab Fix quoting in test_counting_with_single_conditions 2008-06-11 19:21:47 -07:00
Ben Munat
ddab9d7fdf Add :from option to calculations. [#397 state:resolved] 2008-06-11 18:07:57 -07:00
Jan De Poorter
d0b3685a0e Added some has_many tests
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-06-11 13:18:54 +01:00
Jan De Poorter
7f140bbdda Add :validate option to associations. [#301 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-06-11 12:21:57 +01:00
Jeremy Kemper
b440aeb54a PostgreSQL: insert looks up pk and sequence name if not given. [#384 state:resolved] 2008-06-10 15:50:01 -07:00
Brandon Keepers
e94e53f9cd fix eager loading with dynamic finders 2008-06-09 12:05:20 -04:00
Tiago Macedo
a2f6ded732 Fix conditions and order on join tables with limited eager loading. [#372 state:resolved] 2008-06-08 13:01:55 -07:00
Jeremy Kemper
d0956335a6 PostgreSQL: update create_database_with_encoding test also 2008-06-07 13:43:52 -07:00
Craig Demyanovich
aa17716688 Callbacks fire before notifying observers [#230 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2008-06-03 13:38:00 -05:00
Joshua Peek
c08547d226 Namespace Inflector, Dependencies, OrderedOptions, and TimeZone under ActiveSupport [#238 state:resolved] 2008-06-03 13:32:53 -05:00
Pratik Naik
bd75a722a2 Ensure AR#sum result is typecasted properly 2008-06-02 20:41:11 +01:00
Jonathan Viney
4210d85a3f Ensure Associations#sum returns 0 when no rows are returned. [#295 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-06-02 12:50:44 +01:00
David Heinemeier Hansson
3282bf3b50 Added SQL escaping for :limit and :offset in MySQL [Jonathan Wiess] 2008-06-01 09:15:11 -07:00
rick
6a975d6ca2 fix changelog conflict 2008-05-31 17:15:24 -07:00
rick
72483c0d4c Add ActiveRecord::Base.sti_name that checks ActiveRecord::Base#store_full_sti_class? and returns either the full or demodulized name. [rick] [#114 state:resolved] 2008-05-31 17:13:11 -07:00
John D. Hume
f6e921f956 Substitute value into validates_format_of message
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-05-31 16:59:03 -07:00
David Heinemeier Hansson
ef0ea782b1 Added SQL escaping for :limit and :offset [#288 state:closed] (Aaron Bedra, Steven Bristol, Jonathan Wiess) 2008-05-31 16:57:46 -07:00
Tim Harper
0580b31b36 belongs_to polymorphic association assignments update the foreign_id and foreign_type fields regardless of whether the record being assigned is new or not.
fixes the following scenarios:
* I have validates_inclusion_of on the type field for a polymorphic belongs_to association.  I assign a new record to the model's polymorphic relationship of the proper type.  validation fails because the type field has not been updated.

* I replace the value for a ppolymorphic association to a new record of another class.  The type field still says its the previous class, and the id field points to the previous record as well.

[#191 state:closed]
2008-05-31 13:27:25 -07:00
Ryan Bates
f7015336f6 Fix default nil tests for MySQL 5.0.51 [#192 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2008-05-31 12:36:07 -07:00
Jeremy Kemper
03ba5d7b51 Ensure query assertion counts are the same when partial updates are enabled 2008-05-30 04:36:00 -07:00
Andrew White
235d635708 Ensure :select passed in options overrides the one from the scope. [#239 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-05-29 14:10:24 +01:00
Pratik Naik
abb1bd2efa Ensure AssociationCollection#count works with empty condition. [#271 state:resolved] [Jan De Poorter] 2008-05-29 10:20:39 +01:00
Ryan Bates
c2fbcba16d Ensure named_scope#empty? uses count query. [#262 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-05-28 11:02:07 +01:00
Tarmo Tänav
c5d37c0662 Fix tests for postgres 8.3.x
Made test_with_limiting_with_custom_select not dependent on database
default order. Fixed tests with non-US monetary locale. The monetary
type is fixed precision so it should not expect the database to
return a float.

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-05-26 00:45:42 +01:00
Michael Koziarski
6277fd9113 Fix faulty tests introduced in 8d0b4fa39 2008-05-24 18:34:59 +12:00
Ryan Bates
6cba97d2a4 Create through associations can now work with blocks.
Signed-off-by: Michael Koziarski <michael@koziarski.com>

[#248 state:resolved]
2008-05-24 18:26:13 +12:00
Trevor Turk
b88ceb7dc8 add failing test case for block-setting of attributes via association
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-05-24 18:25:33 +12:00
josevalim
8d0b4fa39f Added :select option to has_one and belongs_to, remove unused :order option on belongs_to.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#241 state:resolved]
2008-05-24 17:58:03 +12:00