aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models/project.rb
Commit message (Collapse)AuthorAgeFilesLines
* Ensure `has_and_belongs_to_many` works with `belongs_to_required_by_default`Sean Griffin2015-10-291-0/+8
| | | | | | | | | | | | | Before this commit, if `ActiveRecord::Base.belongs_to_required_by_default` is set to `true`, then creating a record through `has_and_belongs_to_many` fails with the cryptic error message `Left side must exist`. This is because `inverse_of` isn't working properly in this case, presumably since we're doing trickery with anonymous classes in the middle. Rather than following this rabbit hole to try and get `inverse_of` to work in a case that we know is not publicly supported, we can just turn off this validation to match the behavior of 4.2 and earlier.
* Fix merge conflicts for #19938Sean Griffin2015-10-201-0/+1
|\ | | | | | | | | This is a separate commit, as it is not just a changelog conflict. Want to point out the changes in the code
| * Fix for activerecord join dependency instantiate bugMehmet Emin İNAÇ2015-05-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | use only object_id instead parent class and parent id test cases assert_equal use table name in references fix minor problems
* | Fix regression in inverse_of on through associationseileencodes2015-09-261-0/+2
|/ | | | | | | | | | | | | | | | | | | `inverse_of` on through associations was accidently removed/caused to stop working in commit f8d2899 which was part of a refactoring on `ThroughReflection`. To fix we moved `inverse_of` and `check_validity_of_inverse!` to the `AbstractReflection` so it's available to the `ThroughReflection` without having to dup any methods. We then need to delegate `inverse_name` method in `ThroughReflection`. `inverse_name` can't be moved to `AbstractReflection` without moving methods that set the instance variable `@automatic_inverse_of`. This adds a test that ensures that `inverse_of` on a `ThroughReflection` returns the correct class name, and the correct record for the inverse relationship. Fixes #21692
* More unused associations in AR test modelsAkira Matsuda2013-09-101-1/+0
|
* Revert "Merge branch 'master' of github.com:rails/docrails"Vijay Dev2013-08-171-0/+1
| | | | | | | This reverts commit 70d6e16fbad75b89dd1798ed697e7732b8606fa3, reversing changes made to ea4db3bc078fb3093ecdddffdf4f2f4ff3e1e8f9. Seems to be a code merge done by mistake.
* More unused associations in AR test modelsAkira Matsuda2013-07-251-1/+0
|
* Removed support for deprecated `delete_sql` in associations.Neeraj Singh2013-07-031-5/+0
|
* Removed support for deprecated `finder_sql` in associations.Neeraj Singh2013-07-021-8/+0
|
* rename `Relation#uniq` to `Relation#distinct`. `#uniq` still works.Yves Senn2013-03-151-4/+4
| | | | | | | | The similarity of `Relation#uniq` to `Array#uniq` is confusing. Since our Relation API is close to SQL terms I renamed `#uniq` to `#distinct`. There is no deprecation. `#uniq` and `#uniq!` are aliases and will continue to work. I also updated the documentation to promote the use of `#distinct`.
* Goodbye there, very special rubbish!Akira Matsuda2013-01-241-3/+0
|
* Deprecate :finder_sql, :counter_sql, :insert_sql, :delete_sql.Jon Leighton2012-08-011-9/+13
|
* Revert "Remove :finder_sql, :counter_sql, :insert_sql, :delete_sql."Jon Leighton2012-08-011-0/+9
| | | | | | | | | This reverts commit 3803fcce26b837c0117f7d278b83c366dc4ed370. Conflicts: activerecord/CHANGELOG.md It will be deprecated only in 4.0, and removed properly in 4.1.
* Deprecate ActiveRecord::Base.scoped.Jon Leighton2012-07-271-1/+1
| | | | | | | It doesn't serve much purpose now that ActiveRecord::Base.all returns a Relation. The code is moved to active_record_deprecated_finders.
* Remove :finder_sql, :counter_sql, :insert_sql, :delete_sql.Jon Leighton2012-07-201-9/+0
|
* Convert association macros to the new syntaxJon Leighton2012-07-201-9/+9
|
* Deprecate eager-evaluated scopes.Jon Leighton2012-03-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't use this: scope :red, where(color: 'red') default_scope where(color: 'red') Use this: scope :red, -> { where(color: 'red') } default_scope { where(color: 'red') } The former has numerous issues. It is a common newbie gotcha to do the following: scope :recent, where(published_at: Time.now - 2.weeks) Or a more subtle variant: scope :recent, -> { where(published_at: Time.now - 2.weeks) } scope :recent_red, recent.where(color: 'red') Eager scopes are also very complex to implement within Active Record, and there are still bugs. For example, the following does not do what you expect: scope :remove_conditions, except(:where) where(...).remove_conditions # => still has conditions
* Add interpolation of association conditions back in, in the form of proc { ↵Jon Leighton2011-02-141-8/+9
| | | | ... } rather than instance_eval-ing strings
* Let AssociationCollection#find use #scoped to do its finding. Note that I am ↵Jon Leighton2011-01-031-0/+4
| | | | 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.
* Refactor new callbacks and AR implementation.José Valim2009-09-081-1/+2
| | | | Signed-off-by: Joshua Peek <josh@joshpeek.com>
* Revert "Revert "Generate proper :counter_sql from :finder_sql when there is ↵Pratik Naik2009-07-011-0/+6
| | | | | | | | | a newline character immediately following 'SELECT' [#2118 state:resolved]"" This reverts commit 80f1f863cd0f9cba89079511282de5710a2e1832. The feature doesn't work on Postgres, so don't test it on Postgres. Also, Postgres compatibility is irrelevant to the ticket/patch in question.
* Revert "Generate proper :counter_sql from :finder_sql when there is a ↵Yehuda Katz + Carl Lerche2009-06-221-6/+0
| | | | | | | | newline character immediately following 'SELECT' [#2118 state:resolved]" This reverts commit 4851ca9e13a4317342df02ae25b1929340523f7a. The tests do not pass for postgresql.
* Generate proper :counter_sql from :finder_sql when there is a newline ↵Patrick Joyce2009-06-211-0/+6
| | | | | | character immediately following 'SELECT' [#2118 state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Fix tests for sqlite3 3.6.xxPratik Naik2009-04-211-1/+1
|
* Add :having option to find, to use in combination with grouped finds. Also ↵miloops2008-12-011-0/+1
| | | | | | | added to has_many and has_and_belongs_to_many associations. Signed-off-by: Michael Koziarski <michael@koziarski.com> [#1028 state:committed]
* Fixed ordering in ↵Tarmo Tänav2008-08-221-1/+1
| | | | test_find_in_association_with_custom_finder_sql_and_multiple_interpolations
* Introduce the :readonly option to all associations. Records from the ↵Jeremy Kemper2008-02-131-0/+1
| | | | | | association cannot be saved. Closes #11084. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8864 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* move assets and modelsJeremy Kemper2008-01-181-0/+28
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8657 5ecf4fe2-1ee6-0310-87b1-e25e094e27de