aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/association_proxy.rb
Commit message (Collapse)AuthorAgeFilesLines
* Adds title to activerecord/lib/active_record/associations/*Rizwan Reza2010-06-161-0/+2
|
* Revert "removing the extra \"Neeraj Singh2010-06-151-1/+1
| | | | This reverts commit 51a9703b1e80caa30d699f30615f023079874623.
* removing the extra \Neeraj Singh2010-06-151-1/+1
|
* Prevent calling regexp on symbol in Ruby 1.9 in association_proxyErnie Miller2010-05-051-1/+1
| | | | Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Avoid deprecated String#to_a by using Array.wrap(...) instead of Array(...)Jeremy Kemper2010-04-101-1/+3
|
* fisting uninitialized ivar warnings. [#4198 state:resolved]Aaron Patterson2010-03-161-0/+1
| | | | Signed-off-by: wycats <wycats@gmail.com>
* keep AssociationProxy#to_a to avoid warning in Array(post.author), and ↵Xavier Noria2010-03-121-1/+1
| | | | | | | | delegate it to @target in association collections [#4165 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Make sure association proxy does not pass quoted table name to sanitize_sqlPratik Naik2010-01-011-1/+1
|
* Revert "Fix instance_eval calls to association proxies"Joshua Peek2009-12-121-2/+6
| | | | | | | | | | I think it may of broke the build. Lets see. This reverts commit 49e943c4f0ac3459bd53023167aaa08fc8e46733. Conflicts: activerecord/test/cases/associations/has_many_associations_test.rb
* Fix instance_eval calls to association proxiesMat Brown2009-12-021-6/+2
| | | | | | | | In the current stable, ActiveRecord::Associations::AssociationProxy#method_missing calls yield() if a block is given, causing the block to always be evaluated in its calling context. However, in the case of instance_eval, correct behavior requires that the block be passed directly to the @target, rather than being evaluated inside a different block. Incidentally, this also simplifies the code slightly. [#3412 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Ruby 1.9.2: use recursive flattenJeremy Kemper2009-11-141-7/+1
|
* Ruby 1.9.2: fix flatten_deeper to preserve nilsJeremy Kemper2009-11-141-1/+1
|
* Ruby 1.9.2: avoid #flattenJeremy Kemper2009-11-131-4/+16
|
* Remove unused quoted_record_ids, now ARel does this using ARel::In.Emilio Tagua2009-08-181-9/+0
|
* Providing support for :inverse_of as an option to associations.Murray Steele2009-05-041-0/+14
| | | | | | | | | | | | | | | | | | | | | | You can now add an :inverse_of option to has_one, has_many and belongs_to associations. This is best described with an example: class Man < ActiveRecord::Base has_one :face, :inverse_of => :man end class Face < ActiveRecord::Base belongs_to :man, :inverse_of => :face end m = Man.first f = m.face Without :inverse_of m and f.man would be different instances of the same object (f.man being pulled from the database again). With these new :inverse_of options m and f.man are the same in memory instance. Currently :inverse_of supports has_one and has_many (but not the :through variants) associations. It also supplies inverse support for belongs_to associations where the inverse is a has_one and it's not a polymorphic. Signed-off-by: Murray Steele <muz@h-lame.com> Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Ensure JoinAssociation uses aliased table name when multiple associations ↵Pratik Naik2009-04-201-2/+2
| | | | have hash conditions on the same table
* Fix HasManyAssociation#create ignoring the :primary_key option [#1633 ↵Roman Shterenzon2009-01-011-1/+4
| | | | | | state:resolved] Signed-off-by: Frederick Cheung <frederick.cheung@gmail.com>
* Make NoMethodError message more descriptive when an undefined message has ↵Mike Ferrier2008-12-041-1/+4
| | | | | | been sent to an association [#1515 state:resolved] Signed-off-by: Joshua Peek <josh@joshpeek.com>
* 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]
* Ensure methods called on association proxies respect access control. [#1083 ↵Pratik Naik2008-10-131-0/+11
| | | | state:resolved] [Adam Milligan, Pratik]
* Try reloading model on class mismatch [#229 state:resolved]Lawrence Pit2008-10-041-1/+1
| | | | Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Merge docrailsPratik Naik2008-09-031-10/+47
|
* respond_to? passes along splat args to avoid introducing the second arg if ↵Jeremy Kemper2008-08-271-2/+2
| | | | it was omitted
* Ruby 1.9 compat: Hash is now flattenable, so explicitly exclude itJeremy Kemper2008-08-231-1/+1
|
* Updated has_and_belongs_to_many association to fix :finder_sql ↵Nathan Witmer2008-08-161-4/+0
| | | | | | interpolation. [#848 state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Cache sanitized conditions in reflection object for associationsPratik Naik2008-06-271-1/+1
|
* Extract owner_quoted_id so it can be overridden. [#292 state:committed]Andre Arko2008-06-251-0/+4
|
* Verbose ActiveRecord::AssociationTypeMismatch exception message. [#189 ↵Pratik Naik2008-05-211-1/+2
| | | | state:resolved]
* - Updated tzinfo to use Rational() instead of Rational.new! due to "private ↵Nate Wiger2008-05-191-1/+1
| | | | | | method new!" in Ruby 1.9 - Added ^object_id$ as ignore pattern to fixing "redefining object_id" issue in Ruby 1.9 Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Calling ActiveRecord#inspect on an unloaded association won't wipe the ↵Andreas Neuhaus2008-05-081-2/+2
| | | | | | collection [#9 state:resolved] Signed-off-by: Joshua Peek <josh@joshpeek.com>
* Improve documentation coverage and markupXavier Noria2008-05-021-0/+10
| | | | Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Refactor HasManyThroughAssociation to inherit from HasManyAssociation. ↵Pratik Naik2008-04-061-3/+3
| | | | | | Association callbacks and <association>_ids= now work with hm:t. Closes #11516 [rubyruy] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9230 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Improve documentation.Pratik Naik2008-04-051-0/+45
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9226 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Merge the has_finder gem, renamed as 'named_scope'. Closes #11404 [nkallen]Rick Olson2008-03-241-0/+4
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9084 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Improve performance by avoiding named block arguments. Closes #11109 [adymo]Michael Koziarski2008-02-291-2/+6
| | | | | | | Reapplies [8865] with some fixes git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8957 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Revert [8865], broke AP record identifier. Reopens #11109.Jeremy Kemper2008-02-151-8/+2
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8874 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Improve associations performance by avoiding named block arguments. Closes ↵Rick Olson2008-02-141-2/+8
| | | | | | #11109 git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8865 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Introduce the :readonly option to all associations. Records from the ↵Jeremy Kemper2008-02-131-1/+2
| | | | | | association cannot be saved. Closes #11084. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8864 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Remove dead attr_reader from association proxy. Closes #10668 [danger]Michael Koziarski2008-01-261-1/+0
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8737 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* post.comments.reload returns the association rather than the result of ↵Jeremy Kemper2007-12-101-14/+15
| | | | | | load_target. Closes #10438 [Fred Cheung] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8347 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Make reset return nil when using a dangling belongs_to association. Current ↵Michael Koziarski2007-11-291-1/+1
| | | | | | behaviour is to return false which can be confusing. Closes #10293 [fcheung] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8236 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Removed unnecessary or statement (closes #7158) [richcollins]David Heinemeier Hansson2007-09-221-1/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7583 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Formatting, grammar and spelling fixes for the associations documentation. ↵Michael Koziarski2007-08-281-1/+1
| | | | | | [seanhussey] Closes #8899 git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7368 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Refactored in use of extract_options! (closes #9079) [josh]David Heinemeier Hansson2007-07-241-4/+0
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7220 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Sanitize Base#inspect. Closes #8392.Jeremy Kemper2007-05-181-1/+2
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6761 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Aggregate reflection klass works with nested :class_nameJeremy Kemper2007-01-141-1/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5923 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Don't inspect unloaded associations. Closes #2905.Jeremy Kemper2006-11-101-0/+4
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5478 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Removes the ability for eager loaded conditions to be interpolated, since ↵Rick Olson2006-10-091-1/+1
| | | | | | there is no model instance to use as a context for interpolation. #5553 [turnip@turnipspatch.com] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5264 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* has_one associations with a nil target may be safely marshaled. Closes #6279.Jeremy Kemper2006-09-261-0/+2
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5188 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Backed out of new_record? to new? transformation as it would screw up ↵David Heinemeier Hansson2006-09-051-3/+3
| | | | | | existing models that did boolean calls on "new" attributes [DHH] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5018 5ecf4fe2-1ee6-0310-87b1-e25e094e27de