Takehiro Adachi
0123c39f41
Add test to AR's counter_cache_test.rb
...
According to
https://github.com/rails/rails/blob/b601399b72ab56cc01368f02615af99f45d1
4f02/activerecord/lib/active_record/counter_cache.rb#L14, u can pass
more then one association to the `reset_counters` method.
2013-05-18 17:12:46 +09:00
Akira Matsuda
542d6b5e28
unused scope
2013-01-02 05:48:56 +09:00
Guillermo Iguaran
8020f71df1
Remove mass assignment security from ActiveRecord
2012-09-16 23:58:19 -05:00
Jon Leighton
0a12a5f816
Deprecate eager-evaluated scopes.
...
Don't use this:
scope :red, where(color: 'red')
default_scope where(color: 'red')
Use this:
scope :red, -> { where(color: 'red') }
default_scope { where(color: 'red') }
The former has numerous issues. It is a common newbie gotcha to do
the following:
scope :recent, where(published_at: Time.now - 2.weeks)
Or a more subtle variant:
scope :recent, -> { where(published_at: Time.now - 2.weeks) }
scope :recent_red, recent.where(color: 'red')
Eager scopes are also very complex to implement within Active
Record, and there are still bugs. For example, the following does
not do what you expect:
scope :remove_conditions, except(:where)
where(...).remove_conditions # => still has conditions
2012-03-21 22:18:18 +00:00
Jon Leighton
3b797c8c86
DRY up the code which instantiates the association proxy
2011-01-11 13:45:08 -08:00
José Valim
ad4be3d75d
Fix failing test.
2010-05-21 16:20:56 +02:00
José Valim
5c245b91d2
Make sure valid? preceives the context as in ActiveModel API (ht: Carlos Antonio)
2010-05-10 12:28:38 +03:00
Pratik Naik
d60bb0a9e4
Rename named_scope to scope
2010-01-18 04:38:19 +05:30
José Valim
8c5fe60ec8
Simplify repair_validations on AR and make it work with new callbacks.
2010-01-01 03:20:38 +01:00
José Valim
4f37b97033
Changed ActiveRecord to use new callbacks and speed up observers by only notifying events that are actually being consumed.
...
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-09-08 10:26:39 -05:00
Szymon Nowak
1c11437a32
Add primary_key option to belongs_to association
...
[#765 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-07-15 18:13:32 -07:00
Pratik Naik
d758d996d1
Deprecate Model#validate/validate_on_create/validate_on_update. Use Model.validate :method and likewise
2009-03-21 19:07:15 +00:00
Pratik Naik
8828b2ca67
Move all the Active Record validations to Active Model
2009-03-19 23:28:59 +00:00
Adam Cooper
3ca5a0f9fd
Ensure belongs_to association with a counter cache in name spaced model works [ #1678 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-03-06 22:05:18 +00:00
Tarmo Tänav
656f0e7c6c
Fix file permissions
...
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2008-07-31 16:36:23 -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
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
43b81d01d0
move assets and models
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8657 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-18 07:27:03 +00:00