Tobias Bielohlawek
4db72b702f
fixed a 'RecordNotFound' bug when calling 'reload' on a object which doesn't met the default_scope conditions, added test [ #3166 status:resolved]
...
The reload method didn't made use of 'with_exclusive_scope' when reloading the object. This lead to a RecordNotFound exception, in case the object doesn't met the default_scope condition (anymore) - which is obviously a bug. This quick fix makes use of with_exclusive_scope in the reload method as well. See test for full example.
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-02-26 11:14:16 +01:00
Henry Hsu
bf9a0ae12b
Fix a bug where default_scope was overriding attributes given on model initialization [ #3218 status:resolved]
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-02-26 11:09:43 +01:00
Jeremy Kemper
f7b0a857e9
Use Object#singleton_class instead of #metaclass. Prefer Ruby's choice.
2010-02-25 09:32:29 -08:00
José Valim
250c809246
Require persisted? in ActiveModel::Lint and remove new_record? and destroyed? methods. ActionPack does not care if the resource is new or if it was destroyed, it cares only if it's persisted somewhere or not.
2010-02-21 11:12:14 +01:00
Prem Sichanugrist
f0523f72b4
Rename Rails::Subscriber to Rails::LogSubscriber
2010-02-16 22:36:15 +01:00
Pratik Naik
dc3cc6c608
Move batch finders to Relation
2010-02-12 22:31:03 +00:00
SubbaRao Pasupuleti
639e044298
removing , from ,= statement in WrappedDatabaseException constructor
...
[#3830 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2010-02-03 17:02:40 -08:00
Pratik Naik
8ff2fb6f3a
Make default_scope work with Relations
2010-01-23 13:41:09 +05:30
Pratik Naik
6d30002a52
Revert "Refactoring attributes/types" [ #3348 state:open]
...
This reverts commit f936a1f100 .
Conflicts:
activerecord/lib/active_record.rb
activerecord/lib/active_record/base.rb
Revert "Fixed: #without_typecast should only disable typecasting on the duplicated attributes" [#3387 state:open]
This reverts commit 2831996483 .
Reason :
It's not generating attribute methods properly, making object.column 5x slower.
2010-01-22 02:37:07 +05:30
Pratik Naik
798d2828dc
Cache quoted_table_name
2010-01-21 01:28:50 +05:30
Pratik Naik
8d31c9f3a0
Move update and update_all to Relation
2010-01-20 22:20:56 +05:30
Pratik Naik
1fb78e3ed8
Base.merge_conditions is no longer needed
2010-01-20 20:37:17 +05:30
Pratik Naik
8b9bfbe225
Dont delegate Relation#update to arel
2010-01-20 19:01:26 +05:30
Pratik Naik
f216fadc0e
Delegate delete_all to Relation
2010-01-20 18:33:14 +05:30
Pratik Naik
9756805676
Move destroy to Relation
2010-01-20 18:28:45 +05:30
Pratik Naik
223e2a2709
Remove Base.delete as it's same as Relation#delete
2010-01-20 18:24:36 +05:30
Pratik Naik
2493229674
Delegate exists? to Relation
2010-01-20 18:17:37 +05:30
Pratik Naik
8f0f02a166
Make Relation#destroy_all handle all the cases
2010-01-20 18:12:50 +05:30
Pratik Naik
5502780c69
Move array_of_strings? to Relation
2010-01-20 14:01:42 +05:30
Pratik Naik
394c05ed82
Remove stale methods constructing joins
2010-01-20 13:24:53 +05:30
Pratik Naik
52ec4311f5
Delegate all finders to Relation
2010-01-20 03:35:25 +05:30
Pratik Naik
1b78a3f8d5
with_scope no longer needs :reverse_merge
2010-01-20 01:29:18 +05:30
Pratik Naik
9465b84b54
Rename CalculationMethods to Calculations and get rid of the old Calculations module
2010-01-19 22:17:33 +05:30
José Valim
c0d31ca41b
save(false) is gone, use save(:validate => false) instead.
2010-01-17 14:22:34 +01:00
Pratik Naik
dba196cb7f
Merge docrails
2010-01-17 03:26:20 +05:30
Pratik Naik
6e3bee6cf1
Cache Model.arel_table
2010-01-17 03:14:17 +05:30
Pratik Naik
6806483b91
Use arel_table[] instead of unscoped[] to get arel attribute
2010-01-17 03:10:07 +05:30
Pratik Naik
cd90dcb1bd
Rename Model.active_relation to Model.unscoped
2010-01-17 03:00:56 +05:30
Pratik Naik
7f8d4d3c4e
Get rid of Base#merge_includes
2010-01-16 23:59:57 +05:30
Pratik Naik
07e41a8361
No need to set @arel_engine to nil twice. Committed by mistake in 3968825f
2010-01-16 23:17:14 +05:30
Pratik Naik
3968825f5f
Make sure Model#active_relation always adds STI conditions if needed
2010-01-16 23:11:35 +05:30
Pratik Naik
61e831564a
Add Relation#apply_finder_options for applying old finder options
2010-01-16 21:21:20 +05:30
Pratik Naik
5a52523a80
Rename active_relation_engine -> arel_engine and active_relation_table -> arel_table
2010-01-16 16:02:30 +05:30
Pratik Naik
81cd11259c
Remove protected method Class#scoped?
2010-01-16 04:38:16 +05:30
Pratik Naik
2d0bc08a7e
Make type_condition return Arel predicate and not a string condition
2010-01-16 04:21:18 +05:30
Pratik Naik
99dd107760
Remove unused default_select
2010-01-16 04:21:18 +05:30
Pratik Naik
2ee130abec
Remove scope related code from construct_join
2010-01-16 03:51:10 +05:30
Pratik Naik
21ce8eac9b
Remove stale construct_* methods
2010-01-16 03:37:04 +05:30
Pratik Naik
951e485b88
Remove construct_conditions
2010-01-16 02:56:13 +05:30
Pratik Naik
6c997c3c39
Simplify Model.delete_all
2010-01-16 02:38:19 +05:30
Pratik Naik
c5f3811a49
Model.delete should just use scoped.delete
2010-01-16 02:35:53 +05:30
Pratik Naik
3da29f647b
Remove AR#scope() method
2010-01-16 01:42:01 +05:30
Pratik Naik
bed9179aa1
Make scopes use relations under the hood
2010-01-16 00:02:46 +05:30
José Valim
8d78a82d79
Deprecate ActiveRecord::Base.colorize_logging.
2010-01-13 01:19:23 +01:00
Pratik Naik
a04486dc99
Delay building arel relation as long as possible for improved introspection
2010-01-12 22:25:55 +05:30
David Heinemeier Hansson
5e94d3e3ea
Merge
2010-01-03 22:27:28 -08:00
David Heinemeier Hansson
1459c8cc1d
Changed ActiveRecord::Base.store_full_sti_class to be true by default reflecting the previously announced Rails 3 default [DHH]
2010-01-03 19:30:28 -08:00
Pratik Naik
a115b5d79a
Ensure using proper engine for Arel::Table
2010-01-04 02:05:18 +05:30
Pratik Naik
eb7fdb9464
Make Relation#includes behave exactly like the existing :include option
2010-01-03 03:46:08 +05:30
Pratik Naik
6f5f23aaa7
Add Relation#includes to be an equivalent of current finder option :include
2010-01-03 03:24:28 +05:30