Gabe da Silveira
32395899d7
Replace reset_counter_cache with reset_counters that has API inline with existing update_counters method
...
[#1211 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2009-12-03 23:25:11 -08:00
Ben Marini
e55284e825
Add support for Mysql column positioning via #add_column and #change_column
...
add_column and change_column in the Mysql adapter now accept some
additional options:
:first => true # Put the column in front of all the columns
:after => column_name # Put the colmn after 'column_name'
add_column :new_col, :string, :first => true
add_column :another_col, :integer, :default => 0, :after => :new_col
[#3286 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2009-12-03 23:09:57 -08:00
Mat Brown
49e943c4f0
Fix instance_eval calls to association proxies
...
In the current stable, ActiveRecord::Associations::AssociationProxy#method_missing calls yield() if a block is given, causing the block to always be evaluated in its calling context. However, in the case of instance_eval, correct behavior requires that the block be passed directly to the @target, rather than being evaluated inside a different block. Incidentally, this also simplifies the code slightly.
[#3412 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2009-12-02 12:47:09 -08:00
Mike Breen
50c28e78c7
Implement ActiveRecord#reset_counter_cache
...
[#1211 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2009-12-02 12:20:00 -08:00
Jeremy Kemper
78790e47b8
Revert "Revert "Assert primary key does not exist in habtm when the association is defined, instead of doing that everytime a record is inserted.""
...
This reverts commit 2b82708b0e .
[#3128 state:resolved]
Conflicts:
activerecord/lib/active_record/associations.rb
activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
2009-11-23 10:42:32 -08:00
Gabe da Silveira
ea290e77e6
Insert generated association members in the same order they are specified when assigning to a has_many :through using the generated *_ids method
...
[#3491 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2009-11-17 22:25:40 -08:00
Jeremy Kemper
fb61fbd352
Revert "Ensure Model#destroy respects optimistic locking"
...
[#1966 state:open]
This reverts commit 0d922885fb .
Conflicts:
activerecord/lib/active_record/locking/optimistic.rb
2009-11-17 15:35:35 -08:00
Jeremy Kemper
364a8f3902
No need to check for generated method, just redispatch
2009-11-14 01:51:52 -08:00
Jeremy Kemper
6ebb061b18
Ruby 1.9.2: use recursive flatten
2009-11-14 01:50:47 -08:00
Jeremy Kemper
92253829de
Ruby 1.9.2: fix flatten_deeper to preserve nils
2009-11-14 01:12:49 -08:00
Jeremy Kemper
7b3d85db4c
Revert "Split arel_table into method to get a relation and another to memoize the default relation."
...
This reverts commit bd51790895 .
2009-11-13 15:30:51 -08:00
Jeremy Kemper
bd51790895
Split arel_table into method to get a relation and another to memoize the default relation.
2009-11-13 10:53:19 -08:00
Jeremy Kemper
fbbf0086ca
Ruby 1.9.2: avoid #flatten
2009-11-13 09:52:53 -08:00
Jeremy Kemper
fca32eb6c5
Update AR logger subscriber for Notifications subscriber args change
2009-11-11 01:43:58 -08:00
Jeremy Kemper
5fa497abf5
Ruby 1.9: fix Relation respond_to? and method_missing
2009-11-10 11:00:50 -08:00
Matt Jones
d625312fe1
delete correct records for a has_many with :primary_key and :dependent => :delete_all
...
Signed-off-by: Michael Koziarski <michael@koziarski.com >
2009-11-10 18:41:37 +13:00
Xavier Noria
329e7f4441
Integer#even? and Integer#odd? are not needed for Ruby >= 1.8.7
2009-11-09 22:16:51 +01:00
Xavier Noria
f8e713f488
Object#tap is not needed for Ruby >= 1.8.7
2009-11-09 22:16:51 +01:00
Xavier Noria
1979e9c855
Symbol#to_proc is not needed for Ruby >= 1.8.7
2009-11-09 22:16:51 +01:00
Eloy Duran
f125a34501
Define autosave association callbacks when using accepts_nested_attributes_for.
...
This way we don't define all the validation methods for all associations by
default, but only when needed.
[#3355 state:resolved]
2009-11-07 00:42:42 +01:00
Jeremy Kemper
e93c2da141
Arel::In -> Arel::Predicates::In
2009-11-02 17:50:12 -08:00
José Valim
e714b499cc
Move validator, human_name and human_attribute_name to ActiveModel, remove deprecated error messages and add i18n_scope and lookup_ancestors.
...
Signed-off-by: Carl Lerche <carllerche@mac.com >
2009-10-20 17:52:32 -07:00
Eric Chapweske
2831996483
Fixed: #without_typecast should only disable typecasting on the duplicated attributes [ #3387 state:resolved]
...
Signed-off-by: Joshua Peek <josh@joshpeek.com >
2009-10-18 10:22:22 -05:00
Eric Chapweske
f936a1f100
Refactoring attributes/types [ #3348 state:resolved]
...
Signed-off-by: Joshua Peek <josh@joshpeek.com >
2009-10-17 12:37:15 -05:00
Joshua Peek
4cebd41d9e
Fix Rails root in sqlite adapter
2009-10-16 19:08:09 -05:00
Nick Sieger
471a394215
Modify connection pool callbacks to be compatible w/ new style
...
Signed-off-by: Yehuda Katz <wycats@gmail.com >
2009-10-16 10:34:52 -07:00
José Valim
2d7abe245e
Renamed Orchestra to Notifications once again [ #3321 state:resolved]
2009-10-15 18:51:51 -03:00
José Valim
a15e02d44a
Unify benchmark APIs.
2009-10-15 18:19:25 -03:00
José Valim
af0d1fa892
Update Orchestra instrumentations and move part of logging to Orchestra.
2009-10-15 18:18:44 -03:00
José Valim
8b340ab2f6
Revert "Rename Orchestra to Notifications [ #3321 state:resolved]"
...
This reverts commit 8cbf825425 .
2009-10-15 18:06:15 -03:00
Jeremy Kemper
c09a5ffea7
Merge branch 'arel'
2009-10-14 19:32:09 -07:00
Joshua Peek
8cbf825425
Rename Orchestra to Notifications [ #3321 state:resolved]
2009-10-14 19:50:36 -05:00
Michael Koziarski
d5d242660c
Avoid warning spam by flipping to the new callbacks mechanism. These callbacks are actually never called by rails itself, merely there for plugins
2009-10-15 11:21:53 +13:00
Emilio Tagua
06ad817f92
Use ActiveSupport::Callbacks instead of
...
ActiveSupport::DeprecatedCallbacks.
2009-10-13 15:15:00 -03:00
Emilio Tagua
991d1bc200
Merge commit 'rails/master'
2009-10-13 15:06:43 -03:00
Joshua Peek
21e7b84621
Callbacks, DeprecatedCallbacks = NewCallbacks, Callbacks
2009-10-12 22:15:43 -05:00
Pratik Naik
68d416a58f
Add a :limit option to specify the maximum number of records that can be processed by accepts_nested_attributes_for
2009-10-09 16:08:11 +01:00
Pratik Naik
e94caf0788
Store entire options hash in the class var rather than just the reject_if proc for the nested attributes
2009-10-09 15:47:10 +01:00
Emilio Tagua
0cf4662ec5
Merge commit 'rails/master'
2009-10-08 15:05:18 -03:00
Pratik Naik
0c27d0886e
Use indifferent access attributes instead of stringifying them
2009-10-08 00:15:36 +01:00
Pratik Naik
572323135f
Allow accepts_nested_attributes_for :reject_if option accept symbols for using a method
...
Conflicts:
activerecord/lib/active_record/nested_attributes.rb
2009-10-07 23:50:30 +01:00
Emilio Tagua
9a958a3d7d
Relations: Added offset when finding with associations. Delegate array instance
...
methods to to_a.
2009-10-07 12:43:04 -03:00
Emilio Tagua
aadb09b13b
Merge commit 'rails/master'
2009-10-07 12:23:23 -03:00
Emilio Tagua
f13a7bf4e1
Don't send table_name when updating attributes, use the class arel_table.
2009-10-07 12:21:52 -03:00
Emilio Tagua
942d4b2e4f
Don't send table_name when there's no need to.
2009-10-07 12:17:51 -03:00
Emilio Tagua
1d5854826b
Allow preload and eager_load to work on relations at the same time.
2009-10-07 11:57:59 -03:00
Paul Gillard
6361d4234c
Call initialize_copy when cloning [ #3164 state:resolved]
...
Cloned AR objects are now instantiated through initialize_copy rather than
new/initialize. This allows AR classes to override initialize_copy in order to
implement deep cloning.
Signed-off-by: Joshua Peek <josh@joshpeek.com >
2009-10-06 16:25:51 -05:00
Emilio Tagua
23c168a4fd
Initial documentation to Base#all.
2009-10-05 15:27:40 -03:00
Emilio Tagua
1daceeb838
Merge branch 'associations_2'
2009-10-05 15:25:06 -03:00
Emilio Tagua
65f055a3ed
Added eager loading support to Relation and ActiveRecord#all.
2009-10-05 15:24:08 -03:00