Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | scope is always a Relation | Santiago Pastorino | 2011-02-01 | 1 | -3/+1 |
| | |||||
* | Propagate association extensions to scopes called on the association. | Glenn Vanderburg | 2011-02-01 | 1 | -0/+3 |
| | | | | Signed-off-by: Santiago Pastorino <santiago@wyeworks.com> | ||||
* | Rename AssociationProxy#loaded to loaded! as it mutates the association | Jon Leighton | 2011-01-30 | 1 | -3/+3 |
| | |||||
* | Abstract load_target conditional logic | Jon Leighton | 2011-01-30 | 1 | -5/+6 |
| | |||||
* | Remove unused methods conditions, sql_conditions and sanitize_sql | Jon Leighton | 2011-01-30 | 1 | -12/+0 |
| | |||||
* | Let's be less blasé about method visibility on association proxies | Jon Leighton | 2011-01-30 | 1 | -51/+54 |
| | |||||
* | Abstract common code from BelongsToAssociation and HasOneAssociation into ↵ | Jon Leighton | 2011-01-16 | 1 | -4/+5 |
| | | | | SingularAssociation | ||||
* | write the delegate method directly to avoid `delegate` callstack overhead | Aaron Patterson | 2011-01-14 | 1 | -1/+5 |
| | |||||
* | reduce some lasigns | Aaron Patterson | 2011-01-14 | 1 | -2/+1 |
| | |||||
* | just use return value of load_target | Aaron Patterson | 2011-01-12 | 1 | -2/+1 |
| | |||||
* | just call methods on return value of `load_target` | Aaron Patterson | 2011-01-12 | 1 | -8/+3 |
| | |||||
* | default return value is nil | Aaron Patterson | 2011-01-12 | 1 | -1/+0 |
| | |||||
* | @loaded is defined in initialize, so we should not need this | Aaron Patterson | 2011-01-12 | 1 | -2/+0 |
| | |||||
* | just use respond_to? and super rather than aliasing around methods | Aaron Patterson | 2011-01-12 | 1 | -4/+3 |
| | |||||
* | adding a test for no method error | Aaron Patterson | 2011-01-11 | 1 | -11/+5 |
| | |||||
* | Get rid of set_association_target and association_loaded? as the parts of ↵ | Jon Leighton | 2011-01-11 | 1 | -1/+2 |
| | | | | the code that need that can now just use association_proxy(:name).loaded?/target= | ||||
* | We can use the association_proxy method directly in HasOneThroughAssociation now | Jon Leighton | 2011-01-11 | 1 | -17/+18 |
| | |||||
* | Not really worth having the HasAssociation module for just a single method | Jon Leighton | 2011-01-07 | 1 | -2/+9 |
| | |||||
* | Construct an actual ActiveRecord::Relation object for the association scope, ↵ | Jon Leighton | 2011-01-07 | 1 | -16/+42 |
| | | | | rather than a hash which is passed to apply_finder_options. This allows more flexibility in how the scope is created, for example because scope.where(a, b) and scope.where(a).where(b) mean different things. | ||||
* | use attr_reader and alias methods to access instance variables | Aaron Patterson | 2011-01-05 | 1 | -8/+4 |
| | |||||
* | Create the association scope directly rather than going through with_scope | Jon Leighton | 2011-01-03 | 1 | -16/+20 |
| | |||||
* | Let AssociationCollection#find use #scoped to do its finding. Note that I am ↵ | Jon Leighton | 2011-01-03 | 1 | -14/+0 |
| | | | | removing test_polymorphic_has_many_going_through_join_model_with_disabled_include, since this specifies different behaviour for an association than for a regular scope. It seems reasonable to expect scopes and association proxies to behave in roughly the same way rather than having subtle differences. | ||||
* | Rename AssociationProxy#foreign_key_present to foreign_key_present? | Jon Leighton | 2011-01-03 | 1 | -2/+2 |
| | |||||
* | Allow assignment on has_one :through where the owner is a new record [#5137 ↵ | Jon Leighton | 2011-01-03 | 1 | -9/+22 |
| | | | | | | | | | | state:resolved] This required changing the code to keep the association proxy for a belongs_to around, despite its target being nil. Which in turn required various changes to the way that stale target checking is handled, in order to support various edge cases (loaded target is nil then foreign key added, foreign key is changed and then changed back, etc). A side effect is that the code is nicer and more succinct. Note that I am removing test_no_unexpected_aliasing since that is basically checking that the proxy for a belongs_to *does* change, which is the exact opposite of the intention of this commit. Also adding various tests for various edge cases and related things. Phew, long commit message! | ||||
* | Refactor BelongsToAssociation to allow BelongsToPolymorphicAssociation to ↵ | Jon Leighton | 2010-12-31 | 1 | -8/+23 |
| | | | | inherit from it | ||||
* | And owner_quoted_id can go too | Jon Leighton | 2010-12-31 | 1 | -5/+0 |
| | |||||
* | Refactor we_can_set_the_inverse_on_this? to use a less bizarre name amongst ↵ | Jon Leighton | 2010-12-26 | 1 | -9/+15 |
| | | | | other things | ||||
* | Add a HasAssociation module for common code for has_* associations | Jon Leighton | 2010-12-26 | 1 | -54/+5 |
| | |||||
* | Remove AssociationProxy#dependent? - it's badly named and only used in one place | Jon Leighton | 2010-12-26 | 1 | -5/+0 |
| | |||||
* | Associations: DRY up the code which is generating conditions, and make it ↵ | Jon Leighton | 2010-12-26 | 1 | -9/+36 |
| | | | | all use arel rather than SQL strings | ||||
* | Improved strategy for updating a belongs_to association when the foreign key ↵ | Jon Leighton | 2010-12-23 | 1 | -0/+10 |
| | | | | changes. Rather than resetting each affected association when the foreign key changes, we should lazily check for 'staleness' (where fk does not match target id) when the association is accessed. | ||||
* | Partialy revert f1c13b0dd7b22b5f6289ca1a09f1d7a8c7c8584b | José Valim | 2010-11-28 | 1 | -1/+1 |
| | |||||
* | removing space errors | Aaron Patterson | 2010-11-16 | 1 | -2/+2 |
| | |||||
* | use persisted? instead of new_record? wherever possible | David Chelimsky | 2010-11-09 | 1 | -3/+3 |
| | | | | | | | | | | | - persisted? is the API defined in ActiveModel - makes it easier for extension libraries to conform to ActiveModel APIs without concern for whether the extended object is specifically ActiveRecord [#5927 state:committed] Signed-off-by: Santiago Pastorino <santiago@wyeworks.com> | ||||
* | Association Proxy should not undefine the default respond_to_missing | sblackstone | 2010-11-04 | 1 | -1/+1 |
| | |||||
* | Refactoring: replace the mix of variables like @finder_sql, @counter_sql, ↵ | Jon Leighton | 2010-10-30 | 1 | -0/+19 |
| | | | | etc with just a single scope hash (created on initialization of the proxy). This is now used consistently across all associations. Therefore, all you have to do to ensure finding/counting etc is done correctly is implement the scope correctly. | ||||
* | Adds title to activerecord/lib/active_record/associations/* | Rizwan Reza | 2010-06-16 | 1 | -0/+2 |
| | |||||
* | Revert "removing the extra \" | Neeraj Singh | 2010-06-15 | 1 | -1/+1 |
| | | | | This reverts commit 51a9703b1e80caa30d699f30615f023079874623. | ||||
* | removing the extra \ | Neeraj Singh | 2010-06-15 | 1 | -1/+1 |
| | |||||
* | Prevent calling regexp on symbol in Ruby 1.9 in association_proxy | Ernie Miller | 2010-05-05 | 1 | -1/+1 |
| | | | | Signed-off-by: Pratik Naik <pratiknaik@gmail.com> | ||||
* | Avoid deprecated String#to_a by using Array.wrap(...) instead of Array(...) | Jeremy Kemper | 2010-04-10 | 1 | -1/+3 |
| | |||||
* | fisting uninitialized ivar warnings. [#4198 state:resolved] | Aaron Patterson | 2010-03-16 | 1 | -0/+1 |
| | | | | Signed-off-by: wycats <wycats@gmail.com> | ||||
* | keep AssociationProxy#to_a to avoid warning in Array(post.author), and ↵ | Xavier Noria | 2010-03-12 | 1 | -1/+1 |
| | | | | | | | | delegate it to @target in association collections [#4165 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net> | ||||
* | Make sure association proxy does not pass quoted table name to sanitize_sql | Pratik Naik | 2010-01-01 | 1 | -1/+1 |
| | |||||
* | Revert "Fix instance_eval calls to association proxies" | Joshua Peek | 2009-12-12 | 1 | -2/+6 |
| | | | | | | | | | | I think it may of broke the build. Lets see. This reverts commit 49e943c4f0ac3459bd53023167aaa08fc8e46733. Conflicts: activerecord/test/cases/associations/has_many_associations_test.rb | ||||
* | Fix instance_eval calls to association proxies | Mat Brown | 2009-12-02 | 1 | -6/+2 |
| | | | | | | | | 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> | ||||
* | Ruby 1.9.2: use recursive flatten | Jeremy Kemper | 2009-11-14 | 1 | -7/+1 |
| | |||||
* | Ruby 1.9.2: fix flatten_deeper to preserve nils | Jeremy Kemper | 2009-11-14 | 1 | -1/+1 |
| | |||||
* | Ruby 1.9.2: avoid #flatten | Jeremy Kemper | 2009-11-13 | 1 | -4/+16 |
| | |||||
* | Remove unused quoted_record_ids, now ARel does this using ARel::In. | Emilio Tagua | 2009-08-18 | 1 | -9/+0 |
| |