aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations
Commit message (Collapse)AuthorAgeFilesLines
* 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]
* fix assignment to has_one :through associations.Matt Jones2008-11-151-4/+3
| | | | Signed-off-by: Michael Koziarski <michael@koziarski.com>
* Merge with docrails. Also add a rake task to generate guides in your rails ↵Pratik Naik2008-10-212-1/+8
| | | | | | | | application : rake doc:guides The rake task will generate guides inside doc/guides directory of your application. Open index.html to browse.
* Ensure association proxy responds to private class methods defined in ↵Pratik Naik2008-10-161-2/+2
| | | | associated class. [#1083]
* Allow class methods to be sent (via #send) to association proxy (fix for bug ↵Ian White2008-10-161-0/+4
| | | | | | introduced by 691aa20) [#1083] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Ensure methods called on association proxies respect access control. [#1083 ↵Pratik Naik2008-10-132-1/+12
| | | | state:resolved] [Adam Milligan, Pratik]
* Fix has_many :through when the source is a belongs_to association. [#323 ↵Zach Dennis2008-10-041-0/+11
| | | | | | state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Try reloading model on class mismatch [#229 state:resolved]Lawrence Pit2008-10-041-1/+1
| | | | Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Make AssociationCollection start transactions in the correct database.Hongli Lai (Phusion)2008-09-232-6/+21
| | | | | | | | | | AssociationCollection now starts transactions by calling AssociationCollection#transaction instead of @owner.transaction or @reflection.klass.transaction. Signed-off-by: Michael Koziarski <michael@koziarski.com> [#1081 state:committed]
* Association#first and last should not load the association if not needed. ↵Jan De Poorter2008-09-221-3/+4
| | | | | | [#1091 state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Update the documentation to reflect the change handling :group earlierMichael Koziarski2008-09-161-1/+4
|
* When counting grouped records the target should be loaded to return a valid ↵miloops2008-09-151-0/+2
| | | | | | | | | groups count result. Without this change count_records will group for the count in the query and return erroneous results. Signed-off-by: Michael Koziarski <michael@koziarski.com> [#937 state:committed]
* Revert "Add :accessible option to Associations for allowing mass assignments ↵Pratik Naik2008-09-101-6/+0
| | | | | | | | | | | | using hash. [#474 state:resolved]" This reverts commit e0750d6a5c7f621e4ca12205137c0b135cab444a. Conflicts: activerecord/CHANGELOG activerecord/lib/active_record/associations.rb activerecord/lib/active_record/associations/association_collection.rb
* Add special AssociationReflection methods for creating association objects, ↵Hongli Lai (Phusion)2008-09-094-14/+25
| | | | | | | | and modify the code base to use those methods instead of creating association objects directly. This allows plugins to hook into association object creation behavior. [#986 state:resolved] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Merge docrailsPratik Naik2008-09-033-15/+92
|
* Refactored AssociationCollection#count for uniformity and Ruby 1.8.7 support.Ernie Miller2008-08-284-36/+39
| | | | | | [#831 state:resolved] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Implement count limit/offset support for has_many associationsTarmo Tänav2008-08-271-1/+10
| | | | | | [#348 state:resolved] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* respond_to? passes along splat args to avoid introducing the second arg if ↵Jeremy Kemper2008-08-271-2/+2
| | | | it was omitted
* Fix two has_one :through errorspivotal2008-08-271-0/+4
| | | | | | | | * Set the association target on assignment; * Reset target to nil on reset, rather than empty array. Signed-off-by: Michael Koziarski <michael@koziarski.com> [#895 state:committed]
* Ruby 1.9 compat: Hash is now flattenable, so explicitly exclude itJeremy Kemper2008-08-231-1/+1
|
* Fix has_many#count_records. [#865 state:resolved]Xavier Noria2008-08-211-2/+5
| | | | Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Fix that has_one natural assignment to already associated record. [#854 ↵Jakub Kuźma2008-08-211-2/+2
| | | | | | state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Updated has_and_belongs_to_many association to fix :finder_sql ↵Nathan Witmer2008-08-162-7/+1
| | | | | | interpolation. [#848 state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Use type_condition method for hmt STI conditionTarmo Tänav2008-08-151-1/+1
|
* Fixed AssociationCollection#<< resulting in unexpected values in @target ↵Ernie Miller2008-08-081-1/+1
| | | | | | when :uniq => true Signed-off-by: Michael Koziarski <michael@koziarski.com>
* Fix file permissionsTarmo Tänav2008-07-313-0/+0
| | | | Signed-off-by: Joshua Peek <josh@joshpeek.com>
* Add :accessible option to Associations for allowing mass assignments using ↵David Dollar2008-07-141-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | hash. [#474 state:resolved] Allows nested Hashes (i.e. from nested forms) to hydrate the appropriate ActiveRecord models. class Post < ActiveRecord::Base belongs_to :author, :accessible => true has_many :comments, :accessible => true end post = Post.create({ :title => 'Accessible Attributes', :author => { :name => 'David Dollar' }, :comments => [ { :body => 'First Post!' }, { :body => 'Nested Hashes are great!' } ] }) post.comments << { :body => 'Another Comment' } Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Add block syntax to HasManyAssociation#build. [#502 state:resolve]Jason Dew2008-07-141-3/+6
| | | | Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Remove some Symbol#to_proc usage in runtime code. [#484 state:resolved]Cheah Chu Yeow2008-07-092-3/+3
|
* Add support for :primary_key option to has_one as well as has_many so that a ↵Brad Greenlee2008-07-061-1/+10
| | | | | | key other than the default primary key can be used for the association Signed-off-by: Michael Koziarski <michael@koziarski.com>
* Add has_many :primary_key option to allow setting the primary key on a has ↵Andre Arko2008-07-061-0/+8
| | | | | | many association Signed-off-by: Michael Koziarski <michael@koziarski.com>
* Ensure AssociationCollection#size considers all unsaved record. [#305 ↵Pratik Naik2008-07-021-1/+1
| | | | | | state:resolved] [sds] 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-255-11/+15
|
* fix eager loading with dynamic findersBrandon Keepers2008-06-092-1/+2
|
* Add ActiveRecord::Base.sti_name that checks ↵rick2008-05-311-1/+1
| | | | ActiveRecord::Base#store_full_sti_class? and returns either the full or demodulized name. [rick] [#114 state:resolved]
* belongs_to polymorphic association assignments update the foreign_id and ↵Tim Harper2008-05-311-4/+2
| | | | | | | | | | | foreign_type fields regardless of whether the record being assigned is new or not. fixes the following scenarios: * I have validates_inclusion_of on the type field for a polymorphic belongs_to association. I assign a new record to the model's polymorphic relationship of the proper type. validation fails because the type field has not been updated. * I replace the value for a ppolymorphic association to a new record of another class. The type field still says its the previous class, and the id field points to the previous record as well. [#191 state:closed]
* Ensure AssociationCollection#count works with empty condition. [#271 ↵Pratik Naik2008-05-291-1/+1
| | | | state:resolved] [Jan De Poorter]
* Merge docrails.Pratik Naik2008-05-252-3/+3
| | | | Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Create through associations can now work with blocks.Ryan Bates2008-05-241-2/+8
| | | | | | Signed-off-by: Michael Koziarski <michael@koziarski.com> [#248 state:resolved]
* Added :select option to has_one and belongs_to, remove unused :order option ↵josevalim2008-05-243-6/+9
| | | | | | | on belongs_to. Signed-off-by: Michael Koziarski <michael@koziarski.com> [#241 state:resolved]
* Verbose ActiveRecord::AssociationTypeMismatch exception message. [#189 ↵Pratik Naik2008-05-211-1/+2
| | | | state:resolved]
* Add first/last methods to associations/named_scope. [#226 state:resolved]Ryan Bates2008-05-201-1/+24
| | | | Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* - 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>
* best solution?Steven Soroka2008-05-011-2/+2
| | | | Signed-off-by: Steven Soroka <ssoroka78@gmail.com>
* Fixes a subtle bug when using symbols for key definitions in habtm associationsDavid Dollar2008-04-231-3/+3
|
* Fix include? on has_many collections with finder_sql to fall back to Array ↵Joshua Bates2008-04-231-0/+1
| | | | | | include? rather than try to use SQL. [#18 state:resolved]