aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models/author.rb
Commit message (Collapse)AuthorAgeFilesLines
* Remove method redefined warnings for test suiteMatthias Zirnstein2014-01-051-1/+1
| | | | | | | | | | | | | | | | | has_many definitions with "name" as singular and as plural e.g. has_many :welcome_posts_with_comment has_many :welcome_posts_with_comments Ruby mentions it with: lib/active_record/associations/builder/collection_association.rb:65: warning: method redefined; discarding old welcome_posts_with_comment_ids lib/active_record/associations/builder/collection_association.rb:65: warning: previous definition of welcome_posts_with_comment_ids was here lib/active_record/associations/builder/collection_association.rb:75: warning: method redefined; discarding old welcome_posts_with_comment_ids= lib/active_record/associations/builder/collection_association.rb:75: warning: previous definition of welcome_posts_with_comment_ids= was here
* Merge pull request #12011 from jetthoughts/11963_fix_join_with_association_scopeRafael Mendonça França2013-09-161-0/+7
|\ | | | | | | | | | | | | Collapse where constraints to the Arel::Nodes::And node Conflicts: activerecord/CHANGELOG.md
| * Collapse where constraints to one where constraintPaul Nikitochkin2013-09-131-0/+7
| | | | | | | | | | | | | | In order to remove duplication with joining arel where constraints with `AND`, all constraints on `build_arel` are collapsed into one head node: `Arel::Nodes::And` Closes: #11963
* | Clean up unused associations in AR test modelAkira Matsuda2013-09-101-3/+0
|/
* Revert "Merge branch 'master' of github.com:rails/docrails"Vijay Dev2013-08-171-0/+3
| | | | | | | This reverts commit 70d6e16fbad75b89dd1798ed697e7732b8606fa3, reversing changes made to ea4db3bc078fb3093ecdddffdf4f2f4ff3e1e8f9. Seems to be a code merge done by mistake.
* Clean up unused associations in AR test modelAkira Matsuda2013-07-251-3/+0
|
* Make sure that a joins Relation can be merged with has_many :through + ↵Akira Matsuda2013-07-101-1/+5
| | | | | | association proxy Closes #11248.
* Ambiguous reflections are on :through relationships are no longer supported.Aaron Patterson2013-06-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For example, you need to change this: class Author < ActiveRecord::Base has_many :posts has_many :taggings, :through => :posts end class Post < ActiveRecord::Base has_one :tagging has_many :taggings end class Tagging < ActiveRecord::Base end To this: class Author < ActiveRecord::Base has_many :posts has_many :taggings, :through => :posts, :source => :tagging end class Post < ActiveRecord::Base has_one :tagging has_many :taggings end class Tagging < ActiveRecord::Base end
* 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`.
* Fix cases where delete_records on a has_many association caused errorsDerek Kraan2013-01-271-0/+1
| | | | | | | | | | | | | because of an ambiguous column name. This happened if the association model had a default scope that referenced a third table, and the third table also referenced the original table (with an identical foreign_key). Mysql requires that ambiguous columns are deambiguated by using the full table.column syntax. Postgresql and Sqlite use a different syntax for updates altogether (and don't tolerate table.name syntax), so the fix requires always including the full table.column and discarding it later for Sqlite and Postgresql.
* proxy_{owner,reflection,target} are no more availableAkira Matsuda2013-01-241-11/+1
|
* Added STI support to init and building associationsJason Rush2012-11-291-0/+1
| | | | | | | | 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.
* Use method compilation for association methodsJon Leighton2012-08-101-1/+1
| | | | | | | | | Method compilation provides better performance and I think the code comes out cleaner as well. A knock on effect is that methods that get redefined produce warnings. I think this is a good thing. I had to deal with a bunch of warnings coming from our tests, though.
* rm redundant testJon Leighton2012-07-201-2/+0
| | | | now everything is converted to the new style, this is not needed
* Convert association macros to the new syntaxJon Leighton2012-07-201-36/+36
|
* Allow associations to take a lambda which builds the scopeJon Leighton2012-07-131-0/+2
|
* Deprecate eager-evaluated scopes.Jon Leighton2012-03-211-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Deprecate inferred JOINs with includes + SQL snippets.Jon Leighton2012-01-161-2/+2
| | | | | | See the CHANGELOG for details. Fixes #950.
* Revert "Deprecate implicit eager loading. Closes #950."Jon Leighton2012-01-161-2/+2
| | | | This reverts commit c99d507fccca2e9e4d12e49b4387e007c5481ae9.
* Deprecate implicit eager loading. Closes #950.Jon Leighton2011-12-291-2/+2
|
* use GeneratedFeatureMethods module for associationsJosh Susser2011-11-271-1/+0
|
* Ignore :includes on through associationsAndrew White2011-05-241-0/+3
|
* oracle, y u defy meJon Leighton2011-03-161-2/+4
|
* Merge branch 'master' into nested_has_many_throughJon Leighton2011-03-041-0/+11
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * Fix creation of has_many through records with custom primary_key option on ↵Szymon Nowak2010-12-231-0/+1
| | | | | | | | belongs_to [#2990 state:resolved]
| * Don't allow a has_one association to go :through a collection association ↵Jon Leighton2010-12-231-1/+3
| | | | | | | | [#2976 state:resolved]
| * Verify that creating a has_many through record where there is a ↵Jon Leighton2010-12-161-0/+4
| | | | | | | | 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 associationJon Leighton2010-12-161-0/+4
| |
* | Fix naughty trailing whitespaceJon Leighton2010-10-311-3/+3
| |
* | Add explicit tests for the nested through association changes in reflection.rbJon Leighton2010-10-191-0/+1
| |
* | Support the :primary_key option on a through reflection in a nested through ↵Jon Leighton2010-10-191-0/+3
| | | | | | | | association
* | Support for :primary_key option on the source reflection of a through ↵Jon Leighton2010-10-191-0/+2
| | | | | | | | association, where the source is a has_one or has_many
* | Respect the :primary_key option on the through_reflection of (non-nested) ↵Jon Leighton2010-10-191-1/+11
| | | | | | | | through associations
* | Properly support conditions on any of the reflections involved in a nested ↵Jon Leighton2010-10-191-1/+6
| | | | | | | | through association
* | Add test_has_many_through_has_many_through_with_belongs_to_source_reflection ↵Jon Leighton2010-10-141-0/+1
| | | | | | | | (which already works)
* | Added ↵Jon Leighton2010-10-141-0/+1
| | | | | | | | test_has_many_through_has_many_with_has_many_through_habtm_source_reflection and make it pass
* | Add a commented, failing test for using a habtm in a has many through ↵Jon Leighton2010-10-121-3/+5
| | | | | | | | association. I want to refactor how aliasing works first.
* | Add support for table aliasing, with a test that needs aliasing in order to ↵Jon Leighton2010-10-021-1/+2
| | | | | | | | work correctly. This test incidentally provides a more complicated test case (4 inner joins, 2 using polymorphism).
* | Prevent ↵Jon Leighton2010-09-301-2/+2
| | | | | | | | test_has_many_through_a_has_many_through_association_on_through_reflection failing for me due to ordering of the results
* | Initial nested_has_many_through support [#1152]Bodaniel Jeanes2010-09-261-4/+10
|/
* Ensure we can nest include calls [#5285 state:resolved]Neeraj Singh2010-08-121-0/+3
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* update_attributes and update_attributes! are now wrapped in a transactionNeeraj Singh2010-07-131-0/+2
| | | | | | [#922 state:resovled] Signed-off-by: José Valim <jose.valim@gmail.com>
* test cases for record.to_xml [#458 state:resolved]Neeraj Singh2010-04-301-0/+4
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* Fix associations to call :destroy or :delete based on the right :dependent ↵Carlos Antonio da Silva2010-03-091-6/+3
| | | | | | option Signed-off-by: José Valim <jose.valim@gmail.com>
* Refactor new callbacks and AR implementation.José Valim2009-09-081-1/+2
| | | | Signed-off-by: Joshua Peek <josh@joshpeek.com>
* Enable has_many :through for going through a has_one association on the join ↵Gabe da Silveira2009-08-101-0/+1
| | | | | | model [#2719 state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Add primary_key option to belongs_to associationSzymon Nowak2009-07-151-0/+2
| | | | | | [#765 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Ensure :dependent => :delete_all works for association with hash conditionsPratik Naik2009-04-201-1/+1
|
* Ensure JoinAssociation uses aliased table name when multiple associations ↵Pratik Naik2009-04-201-0/+2
| | | | have hash conditions on the same table
* 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]