Commit Graph

2605 Commits

Author SHA1 Message Date
Joshua Peek
7ee5843c3c Fully expand relative rails framework paths and make sure we aren't
adding any to the load path more than once.
2009-12-16 11:56:51 -06:00
Will
bf6af5f719 When passing force_reload = true to an association, don't use the query cache [#1827 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-12-16 10:49:53 -06:00
Joshua Peek
8a50f8a545 Revert "Fix instance_eval calls to association proxies"
I think it may of broke the build. Lets see.

This reverts commit 49e943c4f0.

Conflicts:

	activerecord/test/cases/associations/has_many_associations_test.rb
2009-12-12 19:58:54 -06:00
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
Carlhuda
c1304098cc Reorganize autoloads:
* A new module (ActiveSupport::Autoload) is provide that extends
    autoloading with new behavior.
  * All autoloads in modules that have extended ActiveSupport::Autoload
    will be eagerly required in threadsafe environments
  * Autoloads can optionally leave off the path if the path is the same
    as full_constant_name.underscore
  * It is possible to specify that a group of autoloads live under an
    additional path. For instance, all of ActionDispatch's middlewares
    are ActionDispatch::MiddlewareName, but they live under 
    "action_dispatch/middlewares/middleware_name"
  * It is possible to specify that a group of autoloads are all found
    at the same path. For instance, a number of exceptions might all
    be declared there.
  * One consequence of this is that testing-related constants are not
    autoloaded. To get the testing helpers for a given component,
    require "component_name/test_case". For instance, "action_controller/test_case".
  * test_help.rb, which is automatically required by a Rails application's
    test helper, requires the test_case.rb for all active components, so
    this change will not be disruptive in existing or new applications.
2009-12-02 20:01:08 -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
Jeremy Kemper
2767036392 Use bundled env for tests only 2009-10-19 19:00:48 -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
Jeremy Kemper
6be5f45019 Fix env path 2009-10-14 19:30:06 -07:00
Jeremy Kemper
9c52f96acb Include bundled env in toplevel require, if present 2009-10-14 19:15:33 -07:00
Jeremy Kemper
df55781458 No more toplevel arel sibling 2009-10-14 19:05:06 -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