Commit Graph

2056 Commits

Author SHA1 Message Date
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
9bc75fd007 Remove duplicate code from associations. [Pratik]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9231 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-06 02:18:42 +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
Pratik Naik
aa4af60aad Improve documentation.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9226 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-05 03:52:58 +00:00
Josh Peek
08318b8bcd Replaced callback method evaluation in AssociationCollection class to use ActiveSupport::Callbacks. Modified ActiveSupport::Callbacks::Callback#call to accept multiple arguments.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9225 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-04 20:26:42 +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
Michael Koziarski
295587f0ab Tiny change to allow AR based creation of TIME columns in sqlite. Closes #11465 [h-lame]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9222 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-04 11:45:08 +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
0c0c9fa863 Partial updates off by default
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9196 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-01 15:48:46 +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
3704f4ba2e Fix new migration versions
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9126 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-28 22:14:04 +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
Rick Olson
628ffad98b More efficient association preloading code that compacts a through_records array in a central location. Closes #11427 [danger]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9094 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-26 15:26:59 +00:00
Pratik Naik
ca9413674e Improve documentation.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9093 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-26 12:27:52 +00:00
Michael Koziarski
5c47ceb30b Typo fix in documentation from [9090] References #11422
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9092 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-26 02:44:16 +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
Jeremy Kemper
98d87f38fc Fix schema.rb some more. sponsors.sponsorable_type should be a string. References #4756.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9073 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-21 23:15:21 +00:00
Jeremy Kemper
36baabe24c Fix schema.rb. Please to be testing on more than just MySQL! References #9067.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9072 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-21 23:10:42 +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
David Heinemeier Hansson
54213dadfd Docfixes (closes #11356, #11172, #10523)
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9064 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-20 02:15:29 +00:00