Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | Propagate association extensions to scopes called on the association. | Glenn Vanderburg | 2011-02-01 | 1 | -0/+1 |
| | | | | Signed-off-by: Santiago Pastorino <santiago@wyeworks.com> | ||||
* | Has many through - It is not necessary to manually merge in the conditions ↵ | Jon Leighton | 2011-01-30 | 2 | -1/+5 |
| | | | | hash for the through record, because the creation is done directly on the through association, which will already handle setting the conditions. | ||||
* | We shouldn't be using scoped.scoping { ... } to build associated records, as ↵ | Jon Leighton | 2011-01-30 | 2 | -2/+11 |
| | | | | this can affect validations/callbacks/etc inside the record itself [#6252 state:resolved] | ||||
* | belongs_to records should be initialized within the association scope | Jon Leighton | 2011-01-16 | 1 | -0/+1 |
| | |||||
* | Add create_association! for belongs_to | Jon Leighton | 2011-01-16 | 1 | -0/+1 |
| | |||||
* | DRY up the code which instantiates the association proxy | Jon Leighton | 2011-01-11 | 2 | -0/+11 |
| | |||||
* | has_one should always remove the old record (properly), even if not saving ↵ | Jon Leighton | 2011-01-11 | 1 | -0/+4 |
| | | | | the new record, so we don't get the database into a pickle | ||||
* | Fix polymorphic belongs_to associationproxy raising errors when loading target. | Ernie Miller | 2011-01-11 | 1 | -0/+2 |
| | |||||
* | Construct an actual ActiveRecord::Relation object for the association scope, ↵ | Jon Leighton | 2011-01-07 | 1 | -1/+0 |
| | | | | 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. | ||||
* | send() will raise an ArgumentError, so we should leverage ruby | Aaron Patterson | 2011-01-07 | 1 | -1/+1 |
| | |||||
* | Let AssociationCollection#find use #scoped to do its finding. Note that I am ↵ | Jon Leighton | 2011-01-03 | 3 | -1/+10 |
| | | | | 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. | ||||
* | Allow assignment on has_one :through where the owner is a new record [#5137 ↵ | Jon Leighton | 2011-01-03 | 1 | -0/+1 |
| | | | | | | | | | | 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! | ||||
* | Some basic tests for the :foreign_type option on belongs_to, which was ↵ | Jon Leighton | 2011-01-03 | 1 | -1/+2 |
| | | | | previously completely untested. | ||||
* | Verify that when has_many associated objects are destroyed via :dependent => ↵ | Jon Leighton | 2010-12-31 | 1 | -1/+16 |
| | | | | :destroy, when the parent is destroyed, the callbacks are run | ||||
* | Make sure Model#touch doesn't try to update non existing columns | Pratik Naik | 2010-12-30 | 1 | -1/+3 |
| | |||||
* | Make serialized fixtures work again | Pratik Naik | 2010-12-29 | 1 | -0/+3 |
| | |||||
* | Raise an error for associations which try to go :through a polymorphic ↵ | Jon Leighton | 2010-12-23 | 1 | -1/+2 |
| | | | | association [#6212 state:resolved] | ||||
* | Test to verify that #2189 (count with has_many :through and a named_scope) ↵ | Jon Leighton | 2010-12-23 | 1 | -0/+2 |
| | | | | is fixed | ||||
* | Fix creation of has_many through records with custom primary_key option on ↵ | Szymon Nowak | 2010-12-23 | 2 | -0/+2 |
| | | | | belongs_to [#2990 state:resolved] | ||||
* | Verify that has_one :through preload respects the :conditions [#2976 ↵ | Will Bryant | 2010-12-23 | 1 | -0/+1 |
| | | | | state:resolved] | ||||
* | Don't allow a has_one association to go :through a collection association ↵ | Jon Leighton | 2010-12-23 | 2 | -4/+9 |
| | | | | [#2976 state:resolved] | ||||
* | removing SQL interpolation, please use scoping and attribute conditionals as ↵ | Aaron Patterson | 2010-12-22 | 1 | -3/+0 |
| | | | | a replacement | ||||
* | has_many associations with :dependent => :delete_all should update the ↵ | Jon Leighton | 2010-12-20 | 1 | -0/+2 |
| | | | | counter cache when deleting records | ||||
* | Fix problem where wrong keys are used in JoinAssociation when an association ↵ | Jon Leighton | 2010-12-20 | 1 | -0/+1 |
| | | | | goes :through a belongs_to [#2801 state:resolved] | ||||
* | Fix various issues with the :primary_key option in :through associations ↵ | Jon Leighton | 2010-12-15 | 2 | -0/+13 |
| | | | | [#2421 state:resolved] | ||||
* | Verify that creating a has_many through record where there is a ↵ | Jon Leighton | 2010-12-16 | 2 | -1/+14 |
| | | | | default_scope on the join model works correctly (creates the join record with the default scope applied) | ||||
* | Respect the default_scope on a join model when reading a through association | Jon Leighton | 2010-12-16 | 3 | -1/+12 |
| | |||||
* | Fix hm:t to self table aliasing in construct_scope | Ernie Miller | 2010-12-16 | 1 | -0/+1 |
| | |||||
* | fix warnings, stop using global variables | Aaron Patterson | 2010-11-30 | 1 | -1/+5 |
| | |||||
* | If a nested_attribute is being marked for destruction and at the same time ↵ | Neeraj Singh | 2010-11-24 | 1 | -0/+8 |
| | | | | | | | | an attr_accessor value is being assigned then the value being assigned is being ignored. This patch is a fix for that issue. [#5939 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com> | ||||
* | use persisted? instead of new_record? wherever possible | David Chelimsky | 2010-11-09 | 4 | -4/+4 |
| | | | | | | | | | | | - 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> | ||||
* | Convert :primary_key in association to a string before comparing to column ↵ | Denis Odorcic | 2010-10-30 | 1 | -0/+1 |
| | | | | names, so that for example :primary_key => :another_pk works as well [#5605 state:resolved] | ||||
* | has_one maintains the association with separate after_create/after_update | Xavier Noria | 2010-10-22 | 1 | -0/+37 |
| | | | | | This way parent models can get their own after_create and after_update callbacks fired after has_one has done its job. | ||||
* | scopes can take an object that responds to `call` | Aaron Patterson | 2010-10-19 | 1 | -0/+7 |
| | |||||
* | Allow default_scope to accept a Proc. | Tim Morgan | 2010-10-19 | 1 | -0/+6 |
| | |||||
* | Add some tests for functionality in JoinAssociation which already exists but ↵ | Jon Leighton | 2010-10-13 | 1 | -0/+3 |
| | | | | was previously untested | ||||
* | reorder removed in favor of except(:order).order | Santiago Pastorino | 2010-10-11 | 1 | -1/+0 |
| | |||||
* | expanding the test to include both type of order declaration | Neeraj Singh | 2010-09-18 | 2 | -2/+10 |
| | | | | | | | | | while declaring default_scope Also added test for unscoped using block style with four different combinations Signed-off-by: José Valim <jose.valim@gmail.com> | ||||
* | fixed Subject model after_initialize callback for test_oracle_synonym test | Raimonds Simanovskis | 2010-09-09 | 1 | -3/+7 |
| | |||||
* | failing test for reorder overriding default_scope | Nick Ragaz | 2010-09-05 | 1 | -1/+1 |
| | | | | | | [5528] Signed-off-by: Santiago Pastorino <santiago@wyeworks.com> | ||||
* | order should always be concatenated. | Neeraj Singh | 2010-09-05 | 1 | -0/+5 |
| | | | | | | | | | | | | | | | | | | | | | | order that is declared first has highest priority in all cases. Here are some examples. Car.order('name desc').find(:first, :order => 'id').name Car.named_scope_with_order.named_scope_with_another_order Car.order('id DESC').scoping do Car.find(:first, :order => 'id asc') end No special treatment to with_scope or scoping. Also note that if default_scope declares an order then the order declared in default_scope has the highest priority unless with_exclusive_scope is used. Signed-off-by: Santiago Pastorino <santiago@wyeworks.com> | ||||
* | Change relation merging to always append select, group and order values | Pratik Naik | 2010-08-31 | 1 | -1/+1 |
| | |||||
* | While creating a new record using has_many create method default scope of ↵ | Neeraj Singh | 2010-08-19 | 2 | -0/+8 |
| | | | | | | | | | | | child should be respected. author.posts.create should take into account default_scope defined on post. [#3939: state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com> | ||||
* | Add missing model | Santiago Pastorino | 2010-08-14 | 1 | -0/+2 |
| | |||||
* | Deletes trailing whitespaces (over text files only find * -type f -exec sed ↵ | Santiago Pastorino | 2010-08-14 | 5 | -6/+6 |
| | | | | 's/[ \t]*$//' -i {} \;) | ||||
* | Ensure we can nest include calls [#5285 state:resolved] | Neeraj Singh | 2010-08-12 | 3 | -0/+11 |
| | | | | Signed-off-by: José Valim <jose.valim@gmail.com> | ||||
* | Eager loading an association should not change the count of children | Neeraj Singh | 2010-08-02 | 3 | -0/+12 |
| | | | | | | [#4971 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com> | ||||
* | test and fix collection_singular_ids= with string primary keys [#5125 ↵ | Robert Pankowecki | 2010-08-02 | 1 | -0/+3 |
| | | | | | | state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com> | ||||
* | Object#returning removed | Santiago Pastorino | 2010-07-25 | 1 | -1/+1 |
| | | | | Signed-off-by: José Valim <jose.valim@gmail.com> | ||||
* | Ensure default_scope can be overwriten by association conditions. | José Valim | 2010-07-21 | 1 | -0/+1 |
| |