Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | Raise `ArgumentError` when `has_one` is used with `counter_cache` | Godfrey Chan | 2013-11-29 | 1 | -0/+8 |
| | | | | | | | | | Previously, the `has_one` macro incorrectly accepts the `counter_cache` option due to a bug, although that options was never supported nor functional on `has_one` and `has_one ... through` relationships. It now correctly raises an `ArgumentError` when passed that option. For reference, this bug was introduced in 52f8e4b9. | ||||
* | Fix test name [ci skip] | Carlos Antonio da Silva | 2013-11-14 | 1 | -1/+1 |
| | |||||
* | Fixes problem with replacing has_one association record with itself | Denis Redozubov | 2013-11-11 | 1 | -2/+16 |
| | |||||
* | Save association when primary key is manually set | laurocaetano | 2013-10-24 | 1 | -0/+11 |
| | |||||
* | Avoid empty transaction from setting has_one association on new record. | Dylan Thacker-Smith | 2013-09-11 | 1 | -0/+2 |
| | |||||
* | Dropped deprecated option `:restrict` for `:dependent` in associations | Neeraj Singh | 2013-07-03 | 1 | -16/+0 |
| | |||||
* | Fix #8856 Ensure has_one association=(associate) triggers save. | Chris Thompson | 2013-04-30 | 1 | -0/+16 |
| | | | | | | | | | | | | | | | | | | | | | | | activerecord/lib/active_record/associations.rb states: # [association=(associate)] # Assigns the associate object, extracts the primary key, sets it as the foreign key, # and saves the associate object. Since commit 42dd5d9f2976677a4bf22347f2dde1a8135dfbb4 to fix #7191, this is no longer the case if the associate has changed, but is the same object. For example: # Pirate has_one :ship pirate = Pirate.create!(catchphrase: "A Pirate") ship = pirate.build_ship(name: 'old name') ship.save! ship.name = 'new name' pirate.ship = ship That last line should trigger a save. Although we are not changing the association, the associate (ship) has changed. | ||||
* | Revert "Merge pull request #8989 from robertomiranda/use-rails-4-find-by" | Guillermo Iguaran | 2013-01-18 | 1 | -2/+2 |
| | | | | | This reverts commit 637a7d9d357a0f3f725b0548282ca8c5e7d4af4a, reversing changes made to 5937bd02dee112646469848d7fe8a8bfcef5b4c1. | ||||
* | User Rails 4 find_by | robertomiranda | 2013-01-18 | 1 | -2/+2 |
| | |||||
* | User assert_kind_of, invert assert_equal expectations | Carlos Antonio da Silva | 2012-11-29 | 1 | -3/+3 |
| | |||||
* | Added STI support to init and building associations | Jason Rush | 2012-11-29 | 1 | -0/+30 |
| | | | | | | | | Allows you to do BaseClass.new(:type => "SubClass") as well as parent.children.build(:type => "SubClass") or parent.build_child to initialize an STI subclass. Ensures that the class name is a valid class and that it is in the ancestors of the super class that the association is expecting. | ||||
* | Do not create useless database transaction when building `has_one` association. | Bogdan Gusiev | 2012-11-10 | 1 | -0/+6 |
| | |||||
* | Remove mass_assignment_options from ActiveRecord | Guillermo Iguaran | 2012-09-16 | 1 | -16/+0 |
| | |||||
* | Remove mass assignment security from ActiveRecord | Guillermo Iguaran | 2012-09-16 | 1 | -16/+0 |
| | |||||
* | Remove the dependent_restrict_raises option. | Jon Leighton | 2012-08-10 | 1 | -43/+13 |
| | | | | | | | | | | | | | | | It's not really a good idea to have this as a global config option. We should allow people to specify the behaviour per association. There will now be two new values: * :dependent => :restrict_with_exception implements the current behaviour of :restrict. :restrict itself is deprecated in favour of :restrict_with_exception. * :dependent => :restrict_with_error implements the new behaviour - it adds an error to the owner if there are dependent records present See #4727 for the original discussion of this. | ||||
* | Fix #7191. Remove unnecessary transaction when assigning has_one associations. | kennyj | 2012-08-08 | 1 | -0/+13 |
| | |||||
* | s/scoped/scope/ | Jon Leighton | 2012-08-01 | 1 | -1/+1 |
| | |||||
* | Deprecate ActiveRecord::Base.scoped. | Jon Leighton | 2012-07-27 | 1 | -4/+4 |
| | | | | | | | It doesn't serve much purpose now that ActiveRecord::Base.all returns a Relation. The code is moved to active_record_deprecated_finders. | ||||
* | ActiveRecord::Base.all returns a Relation. | Jon Leighton | 2012-07-27 | 1 | -1/+1 |
| | | | | | | | | | | | Previously it returned an Array. If you want an array, call e.g. `Post.to_a` rather than `Post.all`. This is more explicit. In most cases this should not break existing code, since Relations use method_missing to delegate unknown methods to #to_a anyway. | ||||
* | remove deprecated calls | Jon Leighton | 2012-04-27 | 1 | -3/+3 |
| | |||||
* | find and replace deprecated keys | Jon Leighton | 2012-04-27 | 1 | -1/+1 |
| | |||||
* | %s/find(:\(first\|last\|all\), \([^()]*\))/scoped(\2).\1/gcI amongst other ↵ | Jon Leighton | 2012-04-27 | 1 | -1/+1 |
| | | | | things | ||||
* | remove calls to find(:first), find(:last) and find(:all) | Jon Leighton | 2012-04-26 | 1 | -2/+2 |
| | |||||
* | Fix #5069 - Protect foreign key from mass assignment throught association ↵ | Jean Boussier | 2012-03-05 | 1 | -0/+16 |
| | | | | builder | ||||
* | Fix typo | Rafael Mendonça França | 2012-02-01 | 1 | -2/+2 |
| | |||||
* | Use human attribute name to show the dependent destroy message | Rafael Mendonça França | 2012-02-01 | 1 | -1/+25 |
| | |||||
* | fix has_one, has_many restrict error message | Manoj | 2012-02-01 | 1 | -1/+1 |
| | |||||
* | Remove deprecation warnings from tests | Rafael Mendonça França | 2012-01-31 | 1 | -6/+12 |
| | |||||
* | suggested fixes for :dependent => :restrict deprecation. | Manoj | 2012-01-31 | 1 | -16/+5 |
| | |||||
* | has_many/has_one, :dependent => :restrict, deprecation added. | Manoj | 2012-01-29 | 1 | -2/+46 |
| | |||||
* | Only call set_owner_attributes for has_one association if target exists. | Dieter Komendera | 2011-07-04 | 1 | -0/+11 |
| | |||||
* | Assign the association attributes to the associated record before the ↵ | Jon Leighton | 2011-06-30 | 1 | -0/+7 |
| | | | | before_initialize callback of the record runs. Fixes #1842. | ||||
* | please use ruby -I lib:test path/to/test.rb, or export RUBY_OPT | Aaron Patterson | 2011-06-06 | 1 | -1/+1 |
| | |||||
* | Refactor Active Record test connection setup. Please see the ↵ | Jon Leighton | 2011-06-04 | 1 | -1/+1 |
| | | | | RUNNING_UNIT_TESTS file for details, but essentially you can now configure things in test/config.yml. You can also run tests directly via the command line, e.g. ruby path/to/test.rb (no rake needed, uses default db connection from test/config.yml). This will help us fix the CI by enabling us to isolate the different Rails versions to different databases. | ||||
* | removed deprecated methods, and related tests, from ActiveRecord | Josh Kalderimis | 2011-05-25 | 1 | -9/+0 |
| | |||||
* | Add block setting of attributes to singular associations | Andrew White | 2011-05-17 | 1 | -0/+21 |
| | |||||
* | Pass the attribute and option hashes to build_association | Andrew White | 2011-05-17 | 1 | -0/+16 |
| | | | | | | | The build_association method was added as an API for plugins to hook into in 1398db0. This commit restores this API and the ability to override class.new to return a subclass based on a virtual attribute in the attributes hash. | ||||
* | Don't use mass-assignment protection when setting foreign keys or ↵ | Jon Leighton | 2011-05-12 | 1 | -0/+33 |
| | | | | association conditions on singular associations. Fixes #481 (again). | ||||
* | Don't remove the target if it has already been destroyed | Andrew White | 2011-05-11 | 1 | -0/+9 |
| | |||||
* | Bring back obj.association_loaded? as a deprecated method. Fixes #472. | Jon Leighton | 2011-05-11 | 1 | -0/+9 |
| | |||||
* | Deprecated support for passing hashes and relations to default_scope, in ↵ | Jon Leighton | 2011-04-12 | 1 | -7/+7 |
| | | | | favour of defining a 'default_scope' class method in the model. See the CHANGELOG for more details. | ||||
* | Split AssociationProxy into an Association class (and subclasses) which ↵ | Jon Leighton | 2011-02-18 | 1 | -7/+2 |
| | | | | manages the association, and a CollectionProxy class which is *only* a proxy. Singular associations no longer have a proxy. See CHANGELOG for more. | ||||
* | Add interpolation of association conditions back in, in the form of proc { ↵ | Jon Leighton | 2011-02-14 | 1 | -0/+8 |
| | | | | ... } rather than instance_eval-ing strings | ||||
* | We shouldn't be using scoped.scoping { ... } to build associated records, as ↵ | Jon Leighton | 2011-01-30 | 1 | -0/+15 |
| | | | | this can affect validations/callbacks/etc inside the record itself [#6252 state:resolved] | ||||
* | Support for create_association! for has_one associations | Jon Leighton | 2011-01-11 | 1 | -0/+18 |
| | |||||
* | When assigning a has_one, if anything fails, the assignment should be rolled ↵ | Jon Leighton | 2011-01-11 | 1 | -2/+5 |
| | | | | back entirely | ||||
* | When assigning a has_one, if the new record fails to save, raise an error | Jon Leighton | 2011-01-11 | 1 | -14/+14 |
| | |||||
* | When assigning a has_one, if the existing record fails to be removed from ↵ | Jon Leighton | 2011-01-11 | 1 | -0/+12 |
| | | | | the association, raise an error | ||||
* | has_one should always remove the old record (properly), even if not saving ↵ | Jon Leighton | 2011-01-11 | 1 | -10/+25 |
| | | | | the new record, so we don't get the database into a pickle | ||||
* | Construct an actual ActiveRecord::Relation object for the association scope, ↵ | Jon Leighton | 2011-01-07 | 1 | -8/+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. |