Commit Graph

3139 Commits

Author SHA1 Message Date
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
David Heinemeier Hansson
32d4330b81 Get ready for beta 4 2010-06-08 14:47:02 -04:00
Aaron Patterson
eb69721c9b forcing encoding on 1.9 when dealing with "binary" columns [#4612 state:resolved]
Signed-off-by: wycats <wycats@gmail.com>
2010-06-08 14:33:28 -04:00
Ernie Miller
a4eaa1fd39 Fix multiple self-referencing eager loads failing to join multiple times
[#4679 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-06-08 01:02:19 -04:00
wycats
b97a3f33a3 Merge remote branch 'rsim/oracle_enhanced_rails3' 2010-06-07 23:03:59 -04:00
Santiago Pastorino and José Ignacio Costa
100f8b2dfc update docs before_validation_on_create => before_validation(:on => :create) 2010-06-07 22:21:28 -03:00
José Valim
634c9310e3 Make the logic for nested_records_changed_for_autosave? simpler.
[#4648 state:resolved]
2010-06-07 11:01:10 +02:00
Carlos Antonio da Silva
7eedc3f397 Fixing test class names and refactor line in autosave association
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-07 10:45:47 +02:00
Tom Meier
3f1cdb85b8 Require active support/string/conversions so constantize can be used in associations.rb
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-07 10:29:26 +02:00
Jeremy Kemper
a5f3f3ef7a MySQL: require 2.7 or later so we can rely on result.each_hash 2010-06-05 14:59:51 -07:00
wycats
a260e02fd3 Whoops. _run_*_callbacks is private 2010-06-04 20:11:05 -07:00
wycats
a87b627297 Use faster form of running callbacks 2010-06-04 20:11:05 -07:00
Raimonds Simanovskis
c51fa6bdfc ignore raw_sql_ table alias that is used by Oracle adapter 2010-06-04 22:44:04 +03:00
Raimonds Simanovskis
edf79a7fe7 Downcase quoted table name in regex in count_aliases_from_table_joins
Oracle adapter's quote_table_name returns quoted table name in uppercase and therefore it should be downcased before scanning downcased join_sql
2010-06-04 22:44:03 +03:00
Raimonds Simanovskis
a83e6b1b6a downcase table names in aliased_table_name_for and references_eager_loaded_tables? methods (as Oracle quoted table names are in uppercase) 2010-06-04 22:44:03 +03:00
Pratik Naik
517f709b51 Properly cache association_collection#scopes calls having arguments 2010-06-04 00:53:45 +01:00
Pratik Naik
4b91daff13 Special treatement for Relation#select { with block } 2010-06-02 14:42:25 +01:00
José Valim
0570720d66 Configure generators before invoking. 2010-06-02 09:37:38 +02:00
Mislav Marohnić
bc84bd17d1 fix reset_counters to work even with complex class names
e.g. it guesses that a belongs_to association to Namespace::MyModel is
named "my_model", unlike before where it would look up an association
named "namespace::mymodel" and fail.
2010-05-24 11:44:53 +02:00
Mislav Marohnić
f493f31533 cleanup update/reset_counters: less SQL strings, more ActiveRecord/Arel 2010-05-24 11:42:03 +02:00
Santiago Pastorino
aacf2581cd refactor evals and adds some __FILE__ and __LINE__
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-20 15:18:57 +02:00
Xavier Noria
7f07cc364a Merge remote branch 'rails/master' 2010-05-19 23:29:39 +02:00
Jeremy Kemper
223d6415d0 Revert "Don't carry default value when changing column for a binary type on MySQL"
Broke mysql tests.

This reverts commit edec1afe25.

Conflicts:

	activerecord/test/cases/migration_test.rb

[#3234 state:open]
2010-05-18 11:02:39 -07:00
Étienne Barrié
3809c80cd5 make add_index and remove_index more resilient; new rename_index method; track database limits
[#3452 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-18 10:55:41 -07:00
Ian White
b439d85a19 Nested records (re: autosave) are now updated even when the intermediate parent record is unchanged [#4242 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-18 16:13:00 +02:00
Pratik Naik
5ddc904941 Remove Model.clear_default_scope 2010-05-18 12:22:23 +01:00
José Valim
c536835957 Cut the fat and make session stores rely on request.cookie_jar and change set_session semantics to return the cookie value instead of a boolean. 2010-05-18 03:18:23 +02:00
pleax
4db10bce7b AR::Base#clone fixed to set dirty bits for cloned object
[#2919 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-16 17:45:12 -07:00
Comron Sattari
e1a340a91d cache connection when quoting
[#3642 state:committed]

Signed-off-by: Marius Nuennerich <marius@nuenneri.ch>
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-16 17:40:40 -07:00
Rizwan Reza
d148a6f6ba Merge branch 'master' of git://github.com/rails/rails 2010-05-17 02:40:15 +04:30
Federico Brubacher
6b4e0cc526 a cloned object no longer mimics changed flags from creator , plus a test case [#4614 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-16 23:04:40 +02:00
Nobuhiro IMAI
5d0afe75eb prevent to run fixture accessor (e.g. test_foos for TestFoo model) as a test case [#2992 state:resolved]
Signed-off-by: Wijnand Wiersma <wijnand@videre.net>
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-16 20:14:36 +02:00
Elomar França
edec1afe25 Don't carry default value when changing column for a binary type on MySQL [#3234 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-16 10:45:26 +02:00
Neeraj Singh
5de2e0d416 better documentation for dependent option [#4564 state:resolved] 2010-05-16 06:47:16 +04:30
José Valim
d6cbb27e7b Revert "Make ActiveModel::Errors#add_on_blank and #add_on_empty accept an options hash and make various Validators pass their (filtered) options."
Having a huge array to whitelist options is not the proper way to handle this case. This means that the ActiveModel::Errors object should know about the options given in *all* validators and break the extensibility added by the validators itself. If the intent is to whitelist options before sending them to I18n, each validator should clean its respective options instead of throwing the responsibility to the Errors object.

This reverts commit bc1c8d58ec.
2010-05-15 21:55:16 +02:00
Jeroen van Dijk
bc1c8d58ec 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).

Original patch by Sven Fuchs, some minor changes and has been changed to be applicable to master again

[#4057 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-15 11:17:58 -07:00
Santiago Pastorino
47c9a35506 Reset quoted_table_name after set_table_name [#4568 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2010-05-15 18:53:47 +01:00
Diego Algorta
3436fdfc12 Fix for get_ids when including a belongs_to association on a has_many association [#2896 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2010-05-15 16:53:59 +01:00
wycats
9cfeefb637 Reorganized initializers a bit to enable better hooks for common cases without the need for Railtie. Specifically, the following hooks were added:
* before_configuration: this hook is run immediately after the Application class 
  comes into existence, but before the user has added any configuration. This is
  the appropriate place to set configuration for your plugin
* before_initialize: This is run after all of the user's configuration has completed,
  but before any initializers have begun (in other words, it runs right after
  config/environments/{development,production,test}.rb)
* after_initialize: This is run after all of the initializers have run. It is an
  appropriate place for forking in a preforking setup

Each of these hooks may be used via ActiveSupport.on_load(name) { }. In all these cases, the context inside the block will be the Application object. This means that for simple cases, you can use these hooks without needing to create a Railtie.
2010-05-15 06:09:07 -07:00
Neeraj Singh
58adc67371 STI should not ignore type condition while applying scopes from parent class scopes
[#4507 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-15 09:48:49 +02:00
David Chelimsky + Brian Tatnall
35a114a894 Modified default_scope to merge with any pre-existing default_scope
and added AR::Base::clear_default_scope

- clear_default_scope provides users who rely on the old behaviour
  of each call to default_scope overwriting any previous default
  scopes an opportunity to maintain that behaviour.

[#4583 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-15 08:38:28 +02:00
Neeraj Singh
a0621c1086 Better code formatting and proper line numbers for stack traces
[#4596 state:resolved]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-14 12:24:01 -07:00
Santiago Pastorino
0c37bf8f91 To allow proper fisting of stack trace
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-14 10:36:59 -07:00
Xavier Noria
7321a3a7d3 revises the rdoc of #average according to 5f3bd55, and realigns when clauses 2010-05-12 08:47:55 +02:00