aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models
Commit message (Collapse)AuthorAgeFilesLines
* Allow the :class_name option for associations to take a symbol.Jon Leighton2011-11-041-0/+1
| | | | | This is to avoid confusing newbies, and to be consistent with the fact that other options like :foreign_key already allow a symbol or a string.
* Tests gotta run in 1.8 tooJeremy Kemper2011-10-131-2/+2
|
* Added ActiveRecord::Base.store for declaring simple single-column key/value ↵David Heinemeier Hansson2011-10-131-0/+1
| | | | stores [DHH]
* Raise error when using write_attribute with a non-existent attribute.Jon Leighton2011-09-131-6/+7
| | | | | | | | | Previously we would just silently write the attribute. This can lead to subtle bugs (for example, see the change in AutosaveAssociation where a through association would wrongly gain an attribute. Also, ensuring that we never gain any new attributes after initialization will allow me to reduce our dependence on method_missing.
* Make protected method public so we avoid method_missing.Jon Leighton2011-09-131-4/+5
|
* Ensure we are not comparing a string with a symbol in ↵Jon Leighton2011-09-061-1/+1
| | | | HasManyAssociation#inverse_updates_counter_cache?. Fixes #2755, where a counter cache could be decremented twice as far as it was supposed to be.
* We need to recorder here. Need to drop the order from default scope.Arun Agrawal2011-09-051-0/+10
| | | Fixes #2832
* The join_nodes must be passed to the JoinDependency initializer and ↵Jon Leighton2011-08-291-0/+2
| | | | therefore counted by the alias tracker. This is because the association_joins are aliased on initialization and then the tables are cached, so it is no use to alias the join_nodes later. Fixes #2556.
* Fix default scope thread safety. Thanks @thedarkone for reporting.Jon Leighton2011-08-131-0/+9
|
* use existing model for testing Base.create with #after_initializeGabriel Horner2011-07-242-9/+5
|
* simplify and be more explicit about create and after_initialize testsGabriel Horner2011-07-241-6/+2
|
* fix after_initialize edge case (close #2074 and close #2175)Les Fletcher2011-07-241-0/+13
| | | | fix behavior when after_initialize is defined and a block is passed to Base.create
* Fix exception if old and new targets are both nil. Fixes #1471.Jon Leighton2011-07-121-1/+4
|
* Assign the association attributes to the associated record before the ↵Jon Leighton2011-06-301-2/+7
| | | | before_initialize callback of the record runs. Fixes #1842.
* Apply the default scope earlier when doing calculations. Fixes #1682.Jon Leighton2011-06-231-0/+6
|
* Pass mass-assignment options to nested models - closes #1673.Andrew White2011-06-131-2/+6
|
* Refactor tests to be less brittleJon Leighton2011-06-121-0/+12
|
* Test added for namedscope target.Arun Agrawal2011-06-032-1/+6
|
* Failing test for aggregating on default_scope with selectErik Fonselius2011-05-311-0/+5
|
* Tests for issue #1360Farley Knight2011-05-311-0/+15
|
* Fix infinite recursion where a lazy default scope references a scope. Fixes ↵Jon Leighton2011-05-251-0/+15
| | | | #1264.
* Merge pull request #1254 from pixeltrix/ignore-includes-in-through-scopeJon Leighton2011-05-242-0/+9
|\ | | | | Ignore :includes on through associations
| * Ignore :includes on through associationsAndrew White2011-05-242-0/+9
| |
* | Failing tests for #1233.Andrew White2011-05-241-0/+35
|/
* Refactoring test_has_many_with_pluralize_table_names_false testGuillermo Iguaran2011-05-201-0/+1
|
* Pass the attribute and option hashes to build_associationAndrew White2011-05-171-0/+13
| | | | | | | 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.
* Merge pull request #560 from guilleiguaran/fix_pluralize_table_names_falseJon Leighton2011-05-161-0/+3
|\ | | | | Fixing has_many when ActiveRecord::Base.pluralize_table_names is false
| * Fixing has_many association when ActiveRecord::Base.pluralize_table_names is ↵Guillermo Iguaran2011-05-151-0/+3
| | | | | | | | false. fixes #557
* | CollectionAssociation#merge_target_lists should write to the underlying ↵Jon Leighton2011-05-141-0/+4
|/ | | | attributes when copying, rather than using the assignment method
* Don't use mass-assignment protection when setting foreign keys or ↵Jon Leighton2011-05-121-0/+3
| | | | association conditions on singular associations. Fixes #481 (again).
* Don't use select() values from the join model of a through association. ↵Jon Leighton2011-05-112-0/+8
| | | | Fixes #508.
* Add test to specify that attributes from an association's conditions should ↵Jon Leighton2011-05-102-0/+4
| | | | be assigned without mass-assignment protection when a record is built on the association.
* Don't quote ID's as Arel will quote them -- follow same conventions as the ↵Christopher Meiklejohn2011-05-081-0/+3
| | | | delete method.
* Merge pull request #357 from joshk/assign_attributes.David Heinemeier Hansson2011-05-011-6/+17
|\ | | | | Assign protected attributes with create/new and control the role.
| * singular and collection relations in AR can now specify mass-assignment ↵Josh Kalderimis2011-05-011-6/+17
| | | | | | | | security options (:as and :without_protection) in build, create and create! methods.
* | removed the default_scope deprecations and updated the docs and tests to ↵Josh Kalderimis2011-04-281-6/+18
|/ | | | reflect its use cases
* Added assign_attributes to Active Record which accepts a mass-assignment ↵Josh Kalderimis2011-04-242-24/+19
| | | | security scope using the :as option, while also allowing mass-assignment security to be bypassed using :with_protected
* Bring back support for passing a callable object to the default_scope macro. ↵Jon Leighton2011-04-181-0/+17
| | | | You can also just use a block.
* Un-deprecate using 'default_scope' as a macro, but if you are calling the ↵Jon Leighton2011-04-187-77/+23
| | | | macro multiple times that will give deprecation warnings, and in 3.2 we will simply overwrite the default scope when you call the macro multiple times.
* Revert "Deprecate defining scopes with a callable (lambda, proc, etc) via ↵Jon Leighton2011-04-173-30/+21
| | | | | | | | | | the scope class method. Just define a class method yourself instead." This reverts commit f0e198bfa1e3f9689e0cde1d194a44027fc90b3c. Conflicts: activerecord/test/models/post.rb
* common @jonleighton :bomb:Aaron Patterson2011-04-121-2/+1
|
* Deprecate defining scopes with a callable (lambda, proc, etc) via the scope ↵Jon Leighton2011-04-123-21/+32
| | | | class method. Just define a class method yourself instead.
* Evaluate default scopes at the last possible moment in order to avoid ↵Jon Leighton2011-04-121-0/+2
| | | | problems with default scopes getting included into other scopes and then being unable to remove the default part via unscoped.
* Deprecated support for passing hashes and relations to default_scope, in ↵Jon Leighton2011-04-128-23/+102
| | | | favour of defining a 'default_scope' class method in the model. See the CHANGELOG for more details.
* oracle, y u defy meJon Leighton2011-03-163-7/+9
|
* Add a test for STI on the through where the through is nested, and change ↵Jon Leighton2011-03-052-0/+2
| | | | the code which support this
* Merge branch 'master' into nested_has_many_throughJon Leighton2011-03-0426-35/+225
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: activerecord/CHANGELOG activerecord/lib/active_record/association_preload.rb activerecord/lib/active_record/associations.rb activerecord/lib/active_record/associations/class_methods/join_dependency.rb activerecord/lib/active_record/associations/class_methods/join_dependency/join_association.rb activerecord/lib/active_record/associations/has_many_association.rb activerecord/lib/active_record/associations/has_many_through_association.rb activerecord/lib/active_record/associations/has_one_association.rb activerecord/lib/active_record/associations/has_one_through_association.rb activerecord/lib/active_record/associations/through_association_scope.rb activerecord/lib/active_record/reflection.rb activerecord/test/cases/associations/has_many_through_associations_test.rb activerecord/test/cases/associations/has_one_through_associations_test.rb activerecord/test/cases/reflection_test.rb activerecord/test/cases/relations_test.rb activerecord/test/fixtures/memberships.yml activerecord/test/models/categorization.rb activerecord/test/models/category.rb activerecord/test/models/member.rb activerecord/test/models/reference.rb activerecord/test/models/tagging.rb
| * Rewrote AssociationPreload.Jon Leighton2011-02-281-1/+2
| |
| * Allow building and then later saving has_many :through records, such that ↵Jon Leighton2011-02-183-1/+5
| | | | | | | | the join record is automatically saved too. This requires the :inverse_of option to be set on the source association in the join model. See the CHANGELOG for details. [#4329 state:resolved]
| * Ensure that association_ids uses the correct attribute where the association ↵Jon Leighton2011-02-181-0/+1
| | | | | | | | is a has_many :through with a :primary_key option on the source reflection. [#6376 state:resolved]