Commit Graph

3182 Commits

Author SHA1 Message Date
Jeroen van Dijk
26392c4ac5 Make ActiveModel::Errors#add_on_blank and #add_on_empty accept an options hash and make various Validators pass their (filtered) options.
This makes it possible to pass additional options through Validators to message generation. E.g. plugin authors want to add validates_presence_of :foo, :format => "some format".

Also, cleanup the :default vs :message options confusion in ActiveModel validation message generation.

Also, deprecate ActiveModel::Errors#add_on_blank(attributes, custom_message) in favor of ActiveModel::Errors#add_on_blank(attributes, options).

Also, refactoring of ActiveModel and ActiveRecord Validation tests. Test are a lot more DRY now. Better test coverage as well now.

The first four points were reapplied from an older patch of Sven Fuchs which didn't apply cleanly anymore and was not complete yet.

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-21 11:55:21 +02:00
Emilio Tagua
7b7cedcb8d Don't waste time building relations if there are no values presents. [#4860 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-21 01:10:33 +02:00
Xavier Noria
207fa59675 Merge remote branch 'rails/master'
Conflicts:
	actionpack/lib/abstract_controller/base.rb
2010-06-20 23:13:19 +02:00
Rizwan Reza
3ef1d63a78 All scopes are now cross-referenced. 2010-06-21 00:45:34 +04:30
Steve Abatangle
4515947845 Fix problem with migrations template that can cause bogus code to be created
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-20 12:32:51 +02:00
rohit
95a8f252c0 remove executable permission from files that don't need it. [#4802 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-20 00:50:48 +02:00
Emilio Tagua
e061212e86 Refactor build_arel: move joins out and simplify havings. [#4860 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-20 00:37:55 +02:00
James Le Cuirot
f664c57fe8 Don't overwrite unsaved updates when loading an association but preserve the order of the loaded records. Reapplied from before but now allows already-saved records to be refreshed.
[#4830 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-20 00:32:06 +02:00
José Valim
72725d7b7f Merge branch 'master' of github.com:rails/rails 2010-06-20 00:12:54 +02:00
José Valim
0247995d05 ActiveModel::Validations::Callbacks should not be required by default. 2010-06-19 18:20:02 +02:00
Neeraj Singh
51739d3228 moving before_validation and after_validation functionality from ActiveRecord to ActiveModel
[#4653 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-19 17:59:52 +02:00
José Valim
312f433241 Clear DescendantsTracker on each request. 2010-06-19 17:51:44 +02:00
José Valim
033e0a041f ActiveRecord and ActionPack now use the new descendants implementation. 2010-06-19 17:15:21 +02:00
Brian Durand
237165feb3 Fix bug with rolling back frozen attributes.
[#2991]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-06-18 15:11:17 -07:00
Aaron Patterson
bf6661c5d7 setting the timezone in postgres to whatever ruby thinks the timezone is [#4895 state:resolved]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-06-17 16:49:21 -07:00
Malcolm Locke
1910c92395 Missing quote and indentation wrong 2010-06-17 14:26:13 +12:00
Rizwan Reza
35e3f72af2 Adds backslash to scope for cross-references. 2010-06-16 23:53:10 +04:30
Rizwan Reza
fde9504847 Adds title to activerecord/lib/active_record/associations/* 2010-06-16 22:28:20 +04:30
Rizwan Reza
6445441253 Adds title to the rest of the files in activerecord/lib 2010-06-16 22:25:15 +04:30
Rizwan Reza
4e3eec3d01 Adds title and proper formatting to docs. 2010-06-16 22:22:35 +04:30
Rizwan Reza
0ebdc26cae Adds title where needed. 2010-06-16 22:17:05 +04:30
Rizwan Reza
2b7f08428c Adds basic description and title. 2010-06-16 22:15:04 +04:30
Rizwan Reza
d8277804b2 Adds title and minor changes. 2010-06-16 22:08:14 +04:30
Rizwan Reza
c86915450a Adds title. 2010-06-15 23:11:30 +04:30
Rizwan Reza
cef442f92c Added typewriter tag to code. 2010-06-15 23:03:54 +04:30
Rizwan Reza
c7f78b184d Added description and title to Dynamic Scope Match 2010-06-15 23:02:51 +04:30
Rizwan Reza
4ad6103c4f Adds title and basic description where needed. 2010-06-15 22:41:41 +04:30
Bryan Woods
538b7b97bb Active Record Associations - minor change of DeleteRestrictionError doc for clarity 2010-06-15 12:36:21 -04:00
Evgeniy Dolzhenko
ef404c771d Fix a bunch of minor spelling mistakes 2010-06-15 12:04:22 +04:00
Neeraj Singh
3cc2d196c0 Revert "removing the extra \"
This reverts commit 51a9703b1e.
2010-06-15 00:48:22 -04:00
Neeraj Singh
5e60e65713 Merge branch 'master' of github.com:lifo/docrails 2010-06-15 00:46:44 -04:00
Neeraj Singh
51a9703b1e removing the extra \ 2010-06-15 00:46:35 -04:00
Xavier Noria
5cd3c2a855 Merge remote branch 'rails/master' 2010-06-14 23:24:41 +02:00
Xavier Noria
f17159b029 edit pass: the names of Rails components have a space, ie, "Active Record", not "ActiveRecord" 2010-06-14 23:22:04 +02:00
Xavier Noria
4a8c8804ff refactors AR::Base#reset_table_name 2010-06-14 18:36:04 +02:00
Thiago Pradi
8d82bef58a Documentation for #quoted_table_name method
Signed-off-by: Xavier Noria <fxn@hashref.com>
2010-06-14 17:32:45 +02:00
Pratik Naik
9a23a03505 Remove an unused method 2010-06-12 11:54:52 +05:30
José Valim
85cc1fa657 Revert "Don't overwrite unsaved updates when loading an association but preserve the order of the loaded records. [#4642 state:open]"
This commit introduced a regression described in ticket [#4830].

This reverts commit 0265c708b9.
2010-06-11 17:05:54 +02:00
Evgeniy Dolzhenko
ccf9577aee Fix a bunch of minor spelling mistakes 2010-06-11 14:15:34 +04:00
José Valim
b67ec8ba20 class_attribute is not a direct replacement of class_inheritable_*.
If you are setting a hash or an array in class_attribute or you need
to freeze it, to ensure people won't modify it in place or you need
to dup it on inheritance.
2010-06-10 19:39:09 +02:00
David Heinemeier Hansson
983815632c Cut down even further on rake -T noise 2010-06-09 17:14:53 -04:00
David Heinemeier Hansson
fa15111d30 Silence even more noisy rake task docs 2010-06-09 16:39:01 -04:00
James Le Cuirot
0265c708b9 Don't overwrite unsaved updates when loading an association but preserve the order of the loaded records. [#4642 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2010-06-09 18:17:52 +05:30
Brian Durand
2500e6af66 Make logic for after_commit and after_rollback :on option work like it does for validation callbacks.
[#2991 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-06-08 17:05:29 -04:00
Jeremy Kemper
b070739240 Revert "Temporarily revert "Update after_commit and after_rollback docs and tests to use new style API with an :on options instead of on_* suffix." and "Add after_commit and after_rollback callbacks to ActiveRecord that are called after transactions either commit or rollback on all records saved or destroyed in the transaction.""
This reverts commit 1b2941cba1.

[#2991]
2010-06-08 17:05:29 -04:00
Jeremy Kemper
87cc3d5569 Clarify Fixture#key_ and value_list 2010-06-08 17:05:29 -04:00
Xavier Noria
f1c0bcfbb6 Merge remote branch 'docrails/master' 2010-06-08 22:39:30 +02:00
Andrew Bloomgarden
0e9b9d5985 Fix ActiveRecord::Base.compute_type swallowing NoMethodError. [#4751 state:resolved]
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
2010-06-08 15:34:47 -04:00
Xavier Noria
751f79a033 Merge remote branch 'rails/master' 2010-06-08 21:23:29 +02:00
Jeremy Kemper
1b2941cba1 Temporarily revert "Update after_commit and after_rollback docs and tests to use new style API with an :on options instead of on_* suffix." and "Add after_commit and after_rollback callbacks to ActiveRecord that are called after transactions either commit or rollback on all records saved or destroyed in the transaction."
This reverts commits d2a49e4b1f and da840d13da.

[#2991]

Conflicts:

	activerecord/CHANGELOG
	activerecord/lib/active_record/transactions.rb
	activerecord/test/cases/transaction_callbacks_test.rb
2010-06-08 14:56:08 -04:00