Jeremy Kemper
950ea33242
Fix test to assign the module instead of a new instance
2008-08-24 11:08:49 -07:00
Michael Koziarski
33ed19f428
Merge branch 'patches'
2008-08-24 14:34:47 +02:00
Xavier Noria
e02f0dcc24
Rollback the transaction when a before_* callback returns false.
...
Previously this would have committed the transaction but not carried out save or destroy operation.
[#891 state:committed]
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-08-24 14:34:24 +02:00
Tarmo Tänav
74c3c701f7
Don't set "NULL" as a constraint on nullable columns [ #398 state:resolved]
...
This is already the default and adding it breaks SQL standards compatibility.
2008-08-23 19:51:09 +03:00
Josh Susser
e48e77e022
coerce blank strings to nil values for boolean and integer fields
...
[#860 state:resolved]
2008-08-22 16:26:40 -07:00
Tarmo Tänav
707ee0e269
Made migrations transactional for PostgreSQL [ #834 state:resolved]
...
Patch originally from http://dev.rubyonrails.org/ticket/5470
2008-08-22 14:46:25 -07:00
Jeremy Kemper
9dac5547ad
Merge branch 'master' into i18n
2008-08-22 13:01:53 -07:00
Jeremy Kemper
a6e05b18d6
Merge commit 'sven/i18n' into i18n
2008-08-22 12:44:14 -07:00
Patrick Reagan
683ff235e6
Ensure t.timestamps respects options. [ #828 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-08-22 12:48:00 +01:00
Tarmo Tänav
52ac9d0444
Fixed ordering in test_find_in_association_with_custom_finder_sql_and_multiple_interpolations
2008-08-22 10:39:45 +03:00
Jeremy Kemper
a5eb297424
Revert "coerce blank strings to nil values for boolean and integer fields"
...
This reverts commit aee14630d4dc0856e597794cc731fac68c2d2e34.
[#860 state:incomplete]
2008-08-21 21:34:37 -07:00
S. Brent Faulkner
bbedb6a624
remember created records and select a random one instead of relying on sequential id values starting at 1
...
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-08-21 19:33:26 +02:00
Josh Susser
aee14630d4
coerce blank strings to nil values for boolean and integer fields
...
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-08-21 19:33:25 +02:00
Sven Fuchs
aad429a46e
Merge branch 'master' into i18n
2008-08-21 19:04:39 +02:00
Iain Hecker
cf6840773b
Custom error messages scope improved
2008-08-21 18:40:44 +02:00
Peter Wagenet
8622787f87
Don't interpret decimals as table names in ActiveRecord::Associations::ClassMethods#references_eager_loaded_tables? [ #532 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-08-21 17:21:17 +01:00
Tom Lea
3724dafe71
Fix incorrect signature for NamedScope#respond_to? [ #852 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-08-21 16:39:27 +01:00
Philip Hallstrom
49c0e1e594
Fix generated WHERE IN query for named scopes. [ #583 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-08-21 16:11:28 +01:00
Xavier Noria
a970f916fb
Fix has_many#count_records. [ #865 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-08-21 15:48:04 +01:00
Jakub Kuźma
ea40f71431
Fix that has_one natural assignment to already associated record. [ #854 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-08-21 15:21:21 +01:00
Ryan Bates
2415652660
Support find_all on named scopes. [ #730 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-08-21 12:37:19 +01:00
Iain Hecker
febe2ea977
Locale file changed to yaml
2008-08-20 18:01:12 +02:00
Sven Fuchs
a6a62004c9
add human_name and value to ar validation #generate_message
2008-08-20 17:51:42 +02:00
Iain Hecker
e2b191681e
Added :value as interpolation variable available to error messages
2008-08-20 17:41:43 +02:00
Iain Hecker
c531248938
Introduced AR::Base.human_name to validations
2008-08-20 17:39:43 +02:00
Iain Hecker
ae8a35d8f6
Added Base.human_name method
2008-08-20 17:39:43 +02:00
Tarmo Tänav
96607996ea
Test for eager loading of STI subclasses from htm associations
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-08-16 22:26:11 +01:00
Nathan Witmer
8cfdcdb35d
Updated has_and_belongs_to_many association to fix :finder_sql interpolation. [ #848 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-08-16 22:23:48 +01:00
Tarmo Tänav
2b69a636c4
Fixed STI type condition for eager loading of associations
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-08-16 20:41:19 +01:00
Ryan Bates
8f4d3957a6
Don't raise exception when comparing ActiveRecord::Reflection. [ #842 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-08-16 20:21:36 +01:00
Iain Hecker
ffeab4e0c1
Cleaned up ActiveRecord i18n scoping
2008-08-14 10:48:33 +02:00
Eloy Duran
1ee9e3fa5c
Fix ActiveRecord::NamedScope::Scope#respond_to? [ #818 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-08-13 13:04:42 +01:00
Sven Fuchs
d0ee883e7c
fixing unit tests for active_record validations_i18n
2008-08-13 14:02:26 +02:00
Sven Fuchs
aae9f91659
fix validations_i18n tests for changed locale file format
2008-08-13 10:00:54 +02:00
Tarmo Tänav
a5aad2e81f
Fixed Time/Date object serialization
...
Time/Date objects used to be converted to_s instead of to_uaml
which made them unserializable.
2008-08-12 20:29:07 -07:00
Tom Lea
992fda16ed
Serialized attributes will now always be saved even with partial_updates turned on.
...
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#788 state:committed]
2008-08-12 18:15:50 +02:00
Sven Fuchs
bdf783b5a8
update i18n usage for pluralization hashes (api change)
2008-08-10 21:29:02 +02:00
Ernie Miller
7f6e7ba1f7
Fixed AssociationCollection#<< resulting in unexpected values in @target when :uniq => true
...
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-08-08 15:19:08 +02:00
Ryan Bates
1db7c9cf4a
fixing "test_any_should_not_load_results" so it doesn't depend on latest version of Mocha
...
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-08-08 10:33:29 +02:00
Nik Wakelin
0809747845
Added MigrationProxy to defer loading of Migration classes until they are actually required by the migrator
...
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#747 state:resolved]
2008-08-06 12:46:52 +02:00
Tarmo Tänav
82343859d5
Added missing fixtures for tests which fail to run independently if run after schema reset
...
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-08-04 11:50:15 +02:00
Tarmo Tänav
656f0e7c6c
Fix file permissions
...
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2008-07-31 16:36:23 -05:00
Tarmo Tänav
896a3b9ab8
Fixed test_joins_with_namespaced_model_should_use_correct_type for postgresql
...
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-07-31 19:02:32 +02:00
miloops
fb5cc19707
Fix HasManyThroughAssociationsTest tests. [ #733 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-07-31 17:01:22 +01:00
Pratik Naik
108db00aa9
Raise UnknownAttributeError when unknown attributes are supplied via mass assignment
2008-07-31 15:56:46 +01:00
George Ogata
e8fc894f66
Make observers define #after_find in the model only if needed.
...
[#676 state:resolved]
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-07-26 16:26:08 +02:00
Jan De Poorter
93e10f9911
Ensure NamedScope#any? uses COUNT query wherever possible. [ #680 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-07-23 12:02:17 +01:00
Daniel Guettler
c67713a2fe
Use klass.sti_name to make sure associations take store_full_sti_class into account. [ #671 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-07-22 01:24:47 +01:00
Tom Ward
f205939348
Ensure checked value is a string when validating case-sensitive uniqueness [ #361 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-07-19 16:14:39 +01:00
Joachim Garth
a1fcbd971d
Make sure association preloading works with full STI class name [ #465 state:Resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-07-18 03:44:44 +01:00
Sven Fuchs
931f366ffc
merge forward to current rails/master
2008-07-16 03:41:11 +02:00
Stefan Kaes
fbef982e4b
Observers not longer add an after_find method to the observed class.
...
[#625 state:resolved]
2008-07-15 16:48:16 -07:00
miloops
459e5817a5
update_counters should update nil values.
...
This allows counter columns with default null instead of requiring default 0.
[#493 state:resolved]
2008-07-15 16:21:11 -07:00
Jonathan Viney
4f72feb84c
Move the transaction counter to the connection object rather than maintaining it on the current Thread.
...
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#533 state:resolved]
2008-07-15 21:25:12 +02:00
Tiago Macedo
76df9fa068
Fix integer quoting issues in association preload. [ #602 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-07-14 23:34:19 +01:00
Gabe da Silveira
cd9b24286a
Add assert_sql helper method to check for specific SQL output in Active Record test suite. [ #325 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-07-14 23:22:39 +01:00
Tarmo Tänav
07578ac855
Fixed mysql change_column_default to not make the column always nullable.
...
Also added change_column_null to both mysql and sqlite to keep the api features closer to postgresql.
[#617 state:resolved]
2008-07-14 12:42:01 -07:00
Tarmo Tänav
8f72bc92e2
Fixed test_rename_nonexistent_column for PostgreSQL
...
Also fixed ability to run migration_test.rb alone
[#616 state:resolved]
2008-07-14 12:22:27 -07:00
David Heinemeier Hansson
3037022789
Fixed that create database statements would always include "DEFAULT NULL" (Nick Sieger) [ #334 status:committed]
2008-07-14 10:12:54 -05:00
Sebastian A. Espindola
0176e6adb3
Added db:charset support to PostgreSQL. [ #556 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-07-14 04:11:52 +01:00
David Dollar
e0750d6a5c
Add :accessible option to Associations for allowing mass assignments using hash. [ #474 state:resolved]
...
Allows nested Hashes (i.e. from nested forms) to hydrate the appropriate
ActiveRecord models.
class Post < ActiveRecord::Base
belongs_to :author, :accessible => true
has_many :comments, :accessible => true
end
post = Post.create({
:title => 'Accessible Attributes',
:author => { :name => 'David Dollar' },
:comments => [
{ :body => 'First Post!' },
{ :body => 'Nested Hashes are great!' }
]
})
post.comments << { :body => 'Another Comment' }
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-07-14 02:53:21 +01:00
Jason Dew
c6f397c5ce
Add block syntax to HasManyAssociation#build. [ #502 state:resolve]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-07-14 02:24:12 +01:00
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
Sven Fuchs
84816ae981
align with changes in i18n
2008-07-06 21:20:02 +02: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
Sven Fuchs
e1a7f83fca
use :default for human_attribute_name
2008-07-04 22:22:20 +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
Sven Fuchs
8f74ba96c4
remove core extensions in favor of I18n#translate and I18n#localize
2008-07-02 19:21:07 +02: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
Luca Guidi
66c2508ebb
Make sure mocha is available
2008-06-27 15:00:55 +02: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
Sven Fuchs
8461526f34
silence deprecation warning during validations test
2008-06-23 14:55:07 +02:00
Sven Fuchs
0dddba41fc
rather cosmetic improvements of test coverage
2008-06-23 14:33:29 +02: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
Sven Fuchs
8bfdabbd8b
incorporate #translate usage with several default keys
...
(use first default key that resolves to a translation). this might, depending
on the backend implementation save some expensive lookups (like db lookups)
2008-06-21 17:50:37 +02:00
Sven Fuchs
428aa24d24
Renamed lang/ to locale/ because that's what we seem to
...
standarize on. Also, in future this place can be used for data/code that's
not literally translations but conceptually belongs to the locale (like
custom pluralization algorithms etc.).
2008-06-21 11:35:02 +02:00
Sven Fuchs
c1e2506494
Changed process of storing translations from the
...
client libraries to the backend: clients now can pass a block to
backend#populate which can contain code to load and register translations.
This makes sense for backends that persist their translations (e.g. to db)
so the repeated loading and passing of translations throughout the server
startup would be wasted resources.
2008-06-21 11:27:19 +02:00
Sven Fuchs
585c8c17c3
rename Backend::Simple#add_translations to set_translations
...
because it overwrites existing translations
2008-06-20 09:13:20 +02:00
rick
10c581a6de
fix merge
2008-06-19 09:59:36 -07:00
Sven Fuchs
45d41f0dad
integrating I18n into Rails
2008-06-19 16:25:27 +02: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
Frederick Cheung
cff2291df5
Fix failing tests on mysql 4.1 & ruby 1.8.4. [ #237 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-05-22 12:13:11 +01:00
Frederick Cheung
dd9938a44e
Fix mysql 4.1 incompatibility in the active record schema tests.
...
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#233 state:resolved ]
2008-05-22 11:02:27 +12:00
Ryan Bates
262d23d763
ActiveRecord::Base#reload should clear dirty attributes. [ #231 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-05-21 20:40:52 +01:00
Pratik Naik
281edce6db
Ensure nil to '' doesn't get recorded by dirty for nullable integer columns. [ #150 state:resolved] [Jason Dew, Pratik]
2008-05-20 20:53:47 +01:00
Ryan Bates
73c5963854
Add first/last methods to associations/named_scope. [ #226 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-05-20 12:27:14 +01:00
Pratik Naik
0892515811
Ensure add_column gives valid error for sqlite. [Gunnar Wolf, Pratik] [ #197 state:resolved]
...
SQLite#add_column executes "VACUUM", which fails if inside a live transaction. This patch
ensures a valid exception is raised if add_column is executed within a live transaction for
sqlite adapter.
2008-05-20 11:10:38 +01:00
Jeremy Kemper
1b0128c541
Don't rely on association proxying object_id. [ #225 state:resolved]
2008-05-19 19:12:56 -07:00
Rodrigo Kochenburger
5a3fd46d42
Fixing test for named_scope through a has_many :through
...
The test that checks if a has_many :through association has access to named_scope had a typo and
didn't have the proper fixtures loaded. [#190 state:resolved]
2008-05-15 17:56:23 -07:00
Pratik Naik
802034ff5f
DRY associations code and improve eager loading tests.
2008-05-15 13:47:05 +01:00
John Devine
b28b54cab0
Make sure needed table joins are included :select option. [ #110 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-05-15 13:42:28 +01:00
Rodrigo Kochenburger
bca8751e40
Add ActiveRecord option to store the full class name on STI's type column, allowing one to have STI subclasses in different namespaces [ #114 ]
...
Signed-off-by: rick <technoweenie@gmail.com>
2008-05-13 15:04:11 -07:00
Tim Pope
3a0d8adcf2
Fix tests broken by mocha absence [ #186 state:resolved]
...
Two ActiveRecord tests depended on mocha but were not marked as such.
Place them in a use_mocha block so the test suite passes.
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-05-13 21:02:13 +01:00
Xavier Noria
593e21d6ae
Dirty attributes aren't cleared if save fails. [ #174 state:resolved]
...
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-05-12 17:04:17 -07:00
Frederick Cheung
236f0bb67a
When preloading group by reflection rather than by class [ #125 state:resolved]
...
This avoids extra queries when several subclasses inherit the association
from their parent class, while still coping with subclasses redefining
associations.
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-05-11 22:14:07 +01:00
Jonathan Viney
0cbdd96c34
Fix blank conditions on AssociationCollection#find. [ #104 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-05-11 21:01:18 +01:00
Duncan Beevers
0b8b582e06
Add test for named_scope#proxy_options. [ #97 state:resolved]
2008-05-11 20:33:25 +01:00
Frederick Cheung
3f0dccbbc7
Ensure hm:t preloading honours reflection options. [ #137 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-05-11 20:01:14 +01:00
Aslak Hellesøy
10fdf44236
Added protection against duplicate migration names (Aslak Hellesøy) [ #112 state:resolved]
2008-05-11 13:37:29 -05:00
Alex MacCaw
4cc594bd70
Fix validates_uniqueness_of for SQL keywords [ #23 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-05-11 19:30:03 +01:00
gbuesing
328fada610
ActiveRecord time zone aware attributes: blank string is treated as nil when assigned to writer
2008-05-08 20:31:54 -05:00
Scott Fleckenstein
eb5b93be74
Fix Time.zone.parse from stripping time zone information and make Time aware attribute methods use Time.zone.parse instead of to_time
2008-05-08 19:25:31 -05:00
Andreas Neuhaus
bcb090c56b
Calling ActiveRecord#inspect on an unloaded association won't wipe the collection [ #9 state:resolved]
...
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2008-05-08 00:04:53 -05:00
Tarmo Tänav
0a21193dc6
create_table :force => true no longer tries to drop a non-existing table
...
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-05-07 13:01:46 +12:00
Tarmo Tänav
8877ab5852
Added AbstractAdapter#table_exists? and made AbstractAdapter#table implementation non-optional
...
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-05-07 13:01:46 +12:00
John Devine
8ded457b1b
Added logic to associations.rb to make sure select_for_limited_ids
...
includes joins that are needed to reach tables listed in the :order
or :conditions options if they are not joined directly to the main
active_record table.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#109 state:resolved]
2008-05-06 21:47:10 +12:00
Frederick Cheung
fbebdb0c09
Ensure correct record is returned when preloading has_one where more than one row exists
...
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#73 state:closed]
2008-05-06 21:08:52 +12:00
David Heinemeier Hansson
96980bd561
Added change_table for migrations (Jeff Dean) [ #71 state:resolved]
2008-05-03 11:29:47 -05:00
Jeremy Kemper
e931394d09
Fix failing associate_with_create tests inserting null first_name
2008-05-01 13:53:10 -07:00
David Heinemeier Hansson
e2af713d1c
Merge branch 'master' of git@github.com:rails/rails
2008-05-01 14:32:50 -05:00
Steven Soroka
9c20391bbe
best solution?
...
Signed-off-by: Steven Soroka <ssoroka78@gmail.com>
2008-05-01 14:22:55 -05:00
David Heinemeier Hansson
6f20efdaf7
Fixed AssociationsPreload such that it doesnt require foreign keys to be integers (fcheung) [ #33 state:resolved]
2008-04-30 23:30:50 -05:00
David Heinemeier Hansson
dd120ede53
Added block-setting of attributes for Base.create like Base.new already has (Adam Meehan) [ #39 state:resolved]
2008-04-30 23:14:32 -05:00
Rhett Sutphin
b4c33711c5
Fixed fixture caching with prefixed or suffixed tables.
...
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2008-04-30 16:59:22 -05:00
David Heinemeier Hansson
c353794dff
Fixed that pessimistic locking you reference the quoted table name (Josh Susser) [ #67 state:resolved]
2008-04-30 15:04:08 -05:00
David Heinemeier Hansson
874603ce8d
Change tests against all scope to base scope as all is now used as a finder alias
2008-04-30 00:25:52 -05:00
David Heinemeier Hansson
0a6980f2dc
Let Base.all use conditions etc like first/last
2008-04-28 13:27:52 -05:00
Frederick Cheung
44d2142352
Ensure table names are quoted by the association preloading code.
...
[#45 state:resolved]
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-04-26 12:14:50 +12:00
David Dollar
6c1c16bfd9
Fixes a subtle bug when using symbols for key definitions in habtm associations
2008-04-23 21:02:00 +12:00
Joshua Bates
b6aa0e13b4
Fix include? on has_many collections with finder_sql to fall back to Array include? rather than try to use SQL.
...
[#18 state:resolved]
2008-04-23 20:18:09 +12:00
Frederick Cheung
ae51013c3f
Provide data for the key column otherwise adding a unique index will fail. [ #30 state:closed]
2008-04-23 14:24:20 +12:00
Frederick Cheung
a4fc93c3a9
Use schema.rb for all databases
...
Move adapter specific schema into their own files
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-04-22 13:55:13 +12:00
Joshua Peek
46ab7422d9
Use define_callbacks helper for ActiveRecord validations.
2008-04-20 11:45:44 -05:00
Ian White
82b4faf812
Fix migrations when migrating to a specified version number with a fresh database [ #1 state:resolved]
...
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2008-04-17 13:43:47 -05:00
Michael Koziarski
2e74177d0b
Revert "Ensure that save on child object fails for invalid belongs_to association. Closes #11555 . [rubyruy]"
...
This reverts commit c67e985994362290308073ed2793dd8e7f2a76db.
2008-04-11 16:04:11 +12:00
Pratik Naik
c67e985994
Ensure that save on child object fails for invalid belongs_to association. Closes #11555 . [rubyruy]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9247 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-10 13:48:43 +00:00
Rick Olson
8a5a9dcbf6
Add support for interleaving migrations by storing which migrations have run in the new schema_migrations table. Closes #11493 [jordi]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9244 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-09 16:20:15 +00:00
Rick Olson
78c2d9fc22
ActiveRecord::Base#sum defaults to 0 if no rows are returned. Closes #11550 [kamal]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9243 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-08 05:20:33 +00:00
Josh Peek
4b68982f64
Improve ActiveRecord::Base#table_name unit tests for nested classes. Closes #10289 . [scott_willson]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9237 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-07 19:44:37 +00:00
Pratik Naik
4f39382a2f
Ensure that respond_to? considers dynamic finder methods. Closes #11538 . [floehopper]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9235 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-06 22:26:15 +00:00
Pratik Naik
5b822aca4b
Split associations_test.rb into multiple files based on association type. [Pratik]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9233 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-06 03:01:09 +00:00
Pratik Naik
7ddc8f2e1b
Ensure that save on parent object fails for invalid has_one association. Closes #10518 . [Pratik]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9232 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-06 02:32:51 +00:00
Pratik Naik
f6b12c11cd
Refactor HasManyThroughAssociation to inherit from HasManyAssociation. Association callbacks and <association>_ids= now work with hm:t. Closes #11516 [rubyruy]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9230 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-06 00:27:12 +00:00
Pratik Naik
15d88885ee
Ensure HABTM#create and HABTM#build do not load entire association. [Pratik]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9229 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-05 16:25:48 +00:00
Michael Koziarski
36b8073ff5
Make HABTM#create behave the same as << with after_add callbacks. Closes #11374 [freels]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9224 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-04 14:37:22 +00:00
Michael Koziarski
50538fb524
Don't double include DISTINCT when the user has already specified it. Closes #11502 [kenneth.kalmer]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9223 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-04 12:06:22 +00:00
Rick Olson
d450ac4459
Tweak ActiveRecord::Base#to_json to include a root value in the returned hash: {post: {title: ...}} [rick]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9202 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-01 20:09:45 +00:00
Rick Olson
e223216e9a
Add efficient #include? to AssociationCollection (for has_many/has_many :through/habtm). [stopdropandrew]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9200 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-01 18:27:22 +00:00
Jeremy Kemper
300c927b6c
Ruby 1.9 compat: force encoding for binary comparison tests
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9193 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-01 06:58:52 +00:00
Jeremy Kemper
ba8e0a846f
Ruby 1.9 compat: work around YAML serialization error exposed by validations tests
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9192 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-01 06:46:40 +00:00
Jeremy Kemper
c3df9bfad2
Ruby 1.9 compat: delete DEFAULTS key from Hash not Omap array
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9191 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-01 06:33:16 +00:00
Jeremy Kemper
e4e3df8ef8
PostgreSQL: create_ and drop_database support. Closes #9042 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9182 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-01 05:01:10 +00:00
Jeremy Kemper
0a2e980ddd
Fix migration test when run in GMT zone. Closes #11477 [thechrisoshow]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9175 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-01 00:28:40 +00:00
Pratik Naik
92cd8811aa
Ensure that validates_uniqueness_of works with with_scope. Closes #9235 . [nik.wakelin, cavalle]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9168 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-31 12:57:47 +00:00
Jeremy Kemper
df0d56c1f6
Force timestamp update
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9162 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-31 03:57:25 +00:00
Jeremy Kemper
c52771e7a0
Fix case-sensitive validates_uniqueness_of. Closes #11366 [miloops]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9160 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-31 01:50:07 +00:00
Jeremy Kemper
97019f9f5a
Partial updates play nice with updated_at/on timestamps
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9159 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-31 01:49:57 +00:00
Jeremy Kemper
3aaf60def8
Add :message option to validates_numericality_of. Closes #11456 [miloops, mdempfle]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9158 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-31 01:49:31 +00:00
Jeremy Kemper
6b9448cdd2
Partial updates include only unsaved attributes. Off by default; set YourClass.partial_updates = true to enable.
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9157 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-31 01:10:04 +00:00
Geoff Buesing
458fd10483
Removing unnecessary uses_tzinfo helper from tests, given that TZInfo is now bundled
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9150 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-30 23:01:06 +00:00
Jeremy Kemper
a5b7f131ed
Ruby 1.9: mark failing assertion
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9147 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-30 06:17:45 +00:00
Jeremy Kemper
373de28029
Ruby 1.9 compat. Trailing whitespace.
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9146 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-30 06:17:37 +00:00
Jeremy Kemper
81286f8587
Dirty typecasts attribute values before comparison, if possible. Closes #11464 [Russell Norris, mroch]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9139 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-29 22:19:26 +00:00
David Heinemeier Hansson
f34d57e2d2
Fixed that validates_size_of :within works in associations ( closes #11295 , #10019 ) [cavalle]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9129 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-29 17:53:44 +00:00
Jeremy Kemper
bbf738f269
Track changes to unsaved attributes
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9127 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-29 00:04:27 +00:00
David Heinemeier Hansson
c00de99f69
Switched to UTC-timebased version numbers for migrations and the schema. This will as good as eliminate the problem of multiple migrations getting the same version assigned in different branches. Also added rake db:migrate:up/down to apply individual migrations that may need to be run when you merge branches ( closes #11458 ) [jbarnette]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9122 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-28 21:21:01 +00:00
Jeremy Kemper
6b5fe9c644
Fix some mistaken dependencies among AR unit tests. Closes #11425 [thechrisoshow]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9118 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-28 20:21:20 +00:00
David Heinemeier Hansson
bdd88810c1
Fixed that has_many :through would ignore the hash conditions ( closes #11447 ) [miloops]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9110 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-28 16:13:57 +00:00
Pratik Naik
533da24bbc
Make sure ActiveRecord tests can run individually. Closes #11425 [thechrisoshow, h-lame]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9109 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-28 11:55:01 +00:00
Rick Olson
c366515abd
Fix issue where the :uniq option of a has_many :through association is ignored when find(:all) is called. Closes #9407 [cavalle]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9096 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-26 15:40:57 +00:00
Rick Olson
1648208ab0
Fix duplicate table alias error when including an association with a has_many :through association on the same join table. Closes #7310 [cavalle]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9095 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-26 15:36:17 +00:00
David Heinemeier Hansson
c10b2255b5
Fixed that ActiveRecord#Base.find_or_create/initialize would not honor attr_protected/accessible when used with a hash ( closes #11422 ) [miloops]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9090 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-25 23:56:48 +00:00
David Heinemeier Hansson
c6f2af5c31
Added ActiveRecord#Base.all/first/last as aliases for find(:all/:first/:last) ( closes #11413 ) [nkallen, thechrisoshow]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9085 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-24 19:59:22 +00:00
Rick Olson
081ddb6f24
Merge the has_finder gem, renamed as 'named_scope'. Closes #11404 [nkallen]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9084 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-24 02:50:02 +00:00
Jeremy Kemper
0ff031992f
Fix merging blank conditions. Closes #10764 [mcmire, cavalle]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9082 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-23 05:00:25 +00:00
Jeremy Kemper
5c1be2812d
has_one :through supports :source_type. Fix up some tests. References #4756 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9075 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-22 02:20:37 +00:00
Rick Olson
c23c9bd11b
Allow association scoping for built/created records if :conditions is specified as a hash. Closes #11393 [miloops]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9068 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-21 18:21:56 +00:00
Rick Olson
273b21faa9
Add has_one :through support, finally. Closes #4756 [thechrisoshow]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9067 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-21 18:09:03 +00:00
Jeremy Kemper
dfa6888311
Migrations: create_table supports primary_key_prefix_type. Closes #10314 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9056 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-18 18:23:14 +00:00
David Heinemeier Hansson
fbf41c72a9
Added logging for dependency load errors with fixtures ( closes #11056 ) [stuthulhu]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9050 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-17 21:48:28 +00:00
Geoff Buesing
54ccdd3343
Time, DateTime and TimeWithZone #in_time_zone defaults to Time.zone. Removing now unneeded #in_current_time_zone. ActiveRecord time zone aware attributes updated to use #in_time_zone
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9047 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-17 05:50:13 +00:00
David Heinemeier Hansson
9e4558671c
Ensure that you can still do expressions in calculations ( closes #11355 ) [nbugajski/cavelle]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9043 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-17 04:02:34 +00:00
David Heinemeier Hansson
2c6e616b90
Fixed that scoped joins would not always be respected ( closes #6821 ) [Theory/Danger]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9022 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-13 18:41:42 +00:00
Rick Olson
7750afc4c1
Ensure that ActiveRecord::Calculations disambiguates field names with the table name. Closes #11027 [cavalle]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9018 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-13 03:06:51 +00:00
David Heinemeier Hansson
bcb47a843b
Added add/remove_timestamps to the schema statements for adding the created_at/updated_at columns on existing tables ( closes #11129 ) [jramirez]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9014 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-13 02:17:04 +00:00
David Heinemeier Hansson
d5a4d5abb4
Added ActiveRecord::Base.find(:last) ( closes #11338 ) [miloops]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9012 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-12 21:26:02 +00:00
Geoff Buesing
8e21ec36cf
test_native_types expects DateTime.local_offset instead of DateTime.now.offset; fixes test breakage due to dst transition
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9003 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-10 06:48:15 +00:00
Pratik Naik
e117350037
Add :readonly option to HasManyThrough associations. Closes #11156 [miloops]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8989 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-07 11:45:07 +00:00
Michael Koziarski
b3b0a0c388
Make the schema dumper respect the schema settings in database.yml. References #8659 [sveiss]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8979 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-03 06:56:31 +00:00
Michael Koziarski
c1abe44306
Make the mysql schema dumper roundtrip the limits of text/blob columns. Closes #7424 [will.bryant]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8969 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-02 04:42:10 +00:00
Michael Koziarski
13a60b83a4
Improve performance by avoiding named block arguments. Closes #11109 [adymo]
...
Reapplies [8865] with some fixes
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8957 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-29 23:16:53 +00:00
Jeremy Kemper
18aa19c68a
Provide a post title for sqlite3
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8943 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-28 21:01:04 +00:00
Jeremy Kemper
5dee6ce9e0
Fix that batched :include would pull in duplicate records in some cases. Closes #11215 [Catfish]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8942 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-28 20:42:01 +00:00
Jeremy Kemper
d6e355d1df
mark encoding
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8941 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-28 20:41:41 +00:00
Jeremy Kemper
8352287c72
Fix edge case with colons in times interpreted as bind variables by requiring that bind vars start with a letter. Closes #10519 [matrix9180]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8936 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-27 23:05:59 +00:00
Jeremy Kemper
558c5ff251
Fix preloading nil polymorphic belongs_to. Closes #11218 [matrix9180]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8933 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-27 22:41:35 +00:00
Jeremy Kemper
0d70f31057
Remove dead code from hmt#delete. Closes #11236 [rubyruy]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8932 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-27 22:26:50 +00:00
Jeremy Kemper
9a947af0e7
PostgreSQL: support server versions 7.4 through 8.0 and the ruby-pg driver. Closes #11127
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8922 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-22 03:26:21 +00:00
Michael Koziarski
44c169397a
Move the eager load nested include tables into schema.rb and use delete_all instead of drop table to reset the state.
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8914 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-20 05:31:03 +00:00
Michael Koziarski
63173630db
Revert to previous mysql-specific assertion, and only run the test on mysql.
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8913 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-20 05:30:16 +00:00
Michael Koziarski
aa088e05dc
remove implicit assumption about mysql in the assertion
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8912 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-20 05:14:46 +00:00
Michael Koziarski
feac84521f
Remove disconnect! in test case, it causes segfaults on sqlite3 and completely destroys postgresql
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8908 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-20 01:24:31 +00:00
Michael Koziarski
e32149ad60
Correct typo in before_type_cast code. Closes #11165 [amishyn]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8898 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-19 21:01:10 +00:00
Jeremy Kemper
ec98a720ec
Remove mysql option from a test that applies to all databases. References #11154 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8897 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-19 06:01:54 +00:00
Jeremy Kemper
331d9c0491
Don't assume all records from nested include are of same class. Closes #11154 [acechase]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8896 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-19 02:56:05 +00:00
Michael Koziarski
21c75e545a
Ensure nested preloading works when associations return nil. Closes #11145 [GMFlash]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8894 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-18 04:49:56 +00:00
Michael Koziarski
f2546164d6
Make dynamic finders respect the :include on HasManyThrough associations. Closes #10998 . [cpytel]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8890 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-18 00:14:54 +00:00
Jeremy Kemper
23e58a0552
Fix observed_class. References #11099 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8889 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-17 22:52:55 +00:00
Geoff Buesing
2920bd22df
ActiveRecord::Base#instantiate_time_object only uses Time.zone when Base.time_zone_aware_attributes is true; leverages Time#time_with_datetime_fallback for readability
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8882 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-16 20:47:01 +00:00
Michael Koziarski
f3fd2b18b7
Add test for Observer#observer_class and change the implementation slightly. Closes #11099 [ernesto.jimenez]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8875 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-15 23:09:51 +00:00
Jeremy Kemper
6f0b0125d0
Fix typo in migration test. Closes #11105 [h-lame]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8873 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-15 20:12:45 +00:00
Jeremy Kemper
dfa786631b
Introduce the :readonly option to all associations. Records from the association cannot be saved. Closes #11084 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8864 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-13 06:32:50 +00:00
Michael Koziarski
08a4c9979d
Remove options from the attributes method, tidy up the implementation. Closes #11093 [juanjo.bazan, Koz]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8863 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-13 02:19:46 +00:00
Michael Koziarski
081eed352f
Fix the pre-quoted table names in the eager tests. [mislav]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8857 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-11 07:24:25 +00:00
Michael Koziarski
d4daf7bba7
Fix eager loading with pre-quoted table names. Closes #11046 [danielmorrison, Koz, Jeremy Kemper]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8856 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-11 02:50:58 +00:00
Geoff Buesing
c9402b2277
Multiparameter attributes for time columns fail over to DateTime when out of range of Time
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8855 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-10 22:46:31 +00:00
Michael Koziarski
cfb8ba0003
Add uses_tzinfo to active record tests to prevent breaking the cc.rb build etc. Closes #11034 [mpalmer]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8808 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-06 22:26:47 +00:00
Rick Olson
72385a7be6
Add Time Zone support to ActiveRecord, and config.time_zone property for specifying a default Time Zone. Closes #10982 [Geoff Buesing, rick]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8806 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-06 06:43:02 +00:00
Jeremy Kemper
78253acb59
Revert r8742: remove has_many with :group option since it has sketchy sql support. Closes #10480 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8790 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-03 01:09:58 +00:00
Jeremy Kemper
5bbc461fcb
Fix calculations on associations with custom :foreign_key. Closes #8117 [kamal, jack]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8778 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-02 04:28:42 +00:00
Jeremy Kemper
b1ea27630d
Fix has_many :through a polymorphic has_many. Closes #10529 [Aleksey Kondratenko]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8776 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-02 03:27:31 +00:00
Jeremy Kemper
be827f9348
Fixed preloading belongs_to associations which reference a custom foreign key. References #9640 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8762 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-31 07:50:15 +00:00
Jeremy Kemper
e59978aa86
MySQL: omit text/blob defaults from the schema instead of using an empty string. Closes #10963 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8757 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-30 23:22:58 +00:00
Michael Koziarski
9500ad5fbc
Make sure count works on has_many :through associations using :group. Closes #10480 [remvee]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8742 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-27 02:41:55 +00:00
Michael Koziarski
c48f744400
Make sure that belongs_to counter decrements when assigning nil Closes #10804 [jeanmartin]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8735 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-26 06:23:03 +00:00
Michael Koziarski
176abc842c
Add tests and documentation for allow_blank. Closes #10651 [blj]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8733 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-26 05:08:20 +00:00
Michael Koziarski
a91b7f1975
require test/unit explicitly otherwise the at_exit handler doesn't get called [jbarnette]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8690 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-22 08:32:50 +00:00
Jeremy Kemper
39814fcce0
Merge branch 'ar-test-cleanup' of git://git.geeksomnia.com/rails
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8681 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-21 17:20:51 +00:00
Jeremy Kemper
16b129a68c
belongs_to supports :dependent => :destroy and :delete. Closes #10592 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8675 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-19 05:30:42 +00:00
Jeremy Kemper
355a8ff2cd
Introduce preload query strategy for eager :includes. Closes #9640 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8672 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-19 04:19:53 +00:00
Jeremy Kemper
abdf546ad6
Support aggregations in finder conditions. Closes #10572 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8671 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-19 03:45:24 +00:00
Jeremy Kemper
aae37bb4f7
Extract ActiveSupport::Callbacks from Active Record, test case setup and teardown, and ActionController::Dispatcher. Closes #10727 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8664 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-19 02:44:45 +00:00
Jeremy Kemper
1e70928014
Fix paths
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8661 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-18 07:31:37 +00:00
Jeremy Kemper
42b39ae3f2
Move tests to cases
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8660 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-18 07:30:42 +00:00