rick
72483c0d4c
Add ActiveRecord::Base.sti_name that checks ActiveRecord::Base#store_full_sti_class? and returns either the full or demodulized name. [rick] [ #114 state:resolved]
2008-05-31 17:13:11 -07:00
Tim Harper
0580b31b36
belongs_to polymorphic association assignments update the foreign_id and 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]
2008-05-31 13:27:25 -07:00
Pratik Naik
abb1bd2efa
Ensure AssociationCollection#count works with empty condition. [ #271 state:resolved] [Jan De Poorter]
2008-05-29 10:20:39 +01:00
Pratik Naik
98dc582742
Merge docrails.
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com >
2008-05-25 12:29:00 +01:00
Ryan Bates
6cba97d2a4
Create through associations can now work with blocks.
...
Signed-off-by: Michael Koziarski <michael@koziarski.com >
[#248 state:resolved]
2008-05-24 18:26:13 +12:00
josevalim
8d0b4fa39f
Added :select option to has_one and belongs_to, remove unused :order option on belongs_to.
...
Signed-off-by: Michael Koziarski <michael@koziarski.com >
[#241 state:resolved]
2008-05-24 17:58:03 +12:00
Pratik Naik
19d7b1d22b
Verbose ActiveRecord::AssociationTypeMismatch exception message. [ #189 state:resolved]
2008-05-21 10:46:28 +01:00
Ryan Bates
73c5963854
Add first/last methods to associations/named_scope. [ #226 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com >
2008-05-20 12:27:14 +01:00
Nate Wiger
a34cc42a2c
- Updated tzinfo to use Rational() instead of Rational.new! due to "private 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 >
2008-05-19 19:07:01 -07:00
Andreas Neuhaus
bcb090c56b
Calling ActiveRecord#inspect on an unloaded association won't wipe the collection [ #9 state:resolved]
...
Signed-off-by: Joshua Peek <josh@joshpeek.com >
2008-05-08 00:04:53 -05:00
Xavier Noria
64092de257
Improve documentation coverage and markup
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com >
2008-05-02 14:45:23 +01:00
Steven Soroka
9c20391bbe
best solution?
...
Signed-off-by: Steven Soroka <ssoroka78@gmail.com >
2008-05-01 14:22:55 -05:00
David Dollar
6c1c16bfd9
Fixes a subtle bug when using symbols for key definitions in habtm associations
2008-04-23 21:02:00 +12:00
Joshua Bates
b6aa0e13b4
Fix include? on has_many collections with finder_sql to fall back to Array include? rather than try to use SQL.
...
[#18 state:resolved]
2008-04-23 20:18:09 +12:00
Pratik Naik
9bc75fd007
Remove duplicate code from associations. [Pratik]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9231 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-06 02:18:42 +00:00
Pratik Naik
f6b12c11cd
Refactor HasManyThroughAssociation to inherit from HasManyAssociation. 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
2008-04-06 00:27:12 +00:00
Pratik Naik
15d88885ee
Ensure HABTM#create and HABTM#build do not load entire association. [Pratik]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9229 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-05 16:25:48 +00:00
Pratik Naik
aa4af60aad
Improve documentation.
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9226 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-05 03:52:58 +00:00
Josh Peek
08318b8bcd
Replaced callback method evaluation in AssociationCollection class to use ActiveSupport::Callbacks. Modified ActiveSupport::Callbacks::Callback#call to accept multiple arguments.
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9225 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-04 20:26:42 +00:00
Michael Koziarski
36b8073ff5
Make HABTM#create behave the same as << with after_add callbacks. Closes #11374 [freels]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9224 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-04 14:37:22 +00:00
Rick Olson
e223216e9a
Add efficient #include? to AssociationCollection (for has_many/has_many :through/habtm). [stopdropandrew]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9200 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-01 18:27:22 +00:00
David Heinemeier Hansson
bdd88810c1
Fixed that has_many :through would ignore the hash conditions ( closes #11447 ) [miloops]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9110 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-28 16:13:57 +00:00
Rick Olson
c366515abd
Fix issue where the :uniq option of a has_many :through association is ignored when find(:all) is called. Closes #9407 [cavalle]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9096 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-26 15:40:57 +00:00
Rick Olson
081ddb6f24
Merge the has_finder gem, renamed as 'named_scope'. Closes #11404 [nkallen]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9084 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-24 02:50:02 +00:00
Rick Olson
c23c9bd11b
Allow association scoping for built/created records if :conditions is specified as a hash. Closes #11393 [miloops]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9068 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-21 18:21:56 +00:00
Rick Olson
273b21faa9
Add has_one :through support, finally. Closes #4756 [thechrisoshow]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9067 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-21 18:09:03 +00:00
Pratik Naik
e117350037
Add :readonly option to HasManyThrough associations. Closes #11156 [miloops]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8989 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-07 11:45:07 +00:00
Michael Koziarski
13a60b83a4
Improve performance by avoiding named block arguments. Closes #11109 [adymo]
...
Reapplies [8865] with some fixes
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8957 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-29 23:16:53 +00:00
Jeremy Kemper
0d70f31057
Remove dead code from hmt#delete. Closes #11236 [rubyruy]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8932 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-27 22:26:50 +00:00
Michael Koziarski
f2546164d6
Make dynamic finders respect the :include on HasManyThrough associations. Closes #10998 . [cpytel]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8890 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-18 00:14:54 +00:00
Jeremy Kemper
c55120c8e6
Revert [8865], broke AP record identifier. Reopens #11109 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8874 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-15 21:47:27 +00:00
Michael Koziarski
039f724c7b
Minor formatting changes
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8869 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-14 20:02:19 +00:00
Rick Olson
8a2266c020
Improve associations performance by avoiding named block arguments. Closes #11109
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8865 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-14 07:24:09 +00:00
Jeremy Kemper
dfa786631b
Introduce the :readonly option to all associations. Records from the association cannot be saved. Closes #11084 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8864 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-13 06:32:50 +00:00
Jeremy Kemper
78253acb59
Revert r8742: remove has_many with :group option since it has sketchy sql support. Closes #10480 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8790 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-03 01:09:58 +00:00
Jeremy Kemper
b1ea27630d
Fix has_many :through a polymorphic has_many. Closes #10529 [Aleksey Kondratenko]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8776 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-02 03:27:31 +00:00
Michael Koziarski
9500ad5fbc
Make sure count works on has_many :through associations using :group. Closes #10480 [remvee]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8742 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-27 02:41:55 +00:00
Michael Koziarski
07132865d6
Remove dead attr_reader from association proxy. Closes #10668 [danger]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8737 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-26 08:33:48 +00:00
Michael Koziarski
c48f744400
Make sure that belongs_to counter decrements when assigning nil Closes #10804 [jeanmartin]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8735 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-26 06:23:03 +00:00
Rick Olson
49794485b6
Ensure that modifying has_and_belongs_to_many actions clear the query cache. Closes #10840 [john.andrews]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8653 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-18 01:55:11 +00:00
Jeremy Kemper
ebe3a0d532
More thoroughly quote table names. Exposes some issues with sqlite2 adapter. Closes #10698 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8571 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-05 14:58:28 +00:00
Jeremy Kemper
8b5f4e474f
Ruby 1.9 compat: fix warnings, shadowed block vars, and unitialized instance vars
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8481 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-12-22 11:26:03 +00:00
Rick Olson
66e97c34c1
Ensure that the :uniq option for has_many :through associations retains the order. #10463 [remvee]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8376 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-12-11 20:08:30 +00:00
Jeremy Kemper
220a64e9b6
post.comments.reload returns the association rather than the result of load_target. Closes #10438 [Fred Cheung]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8347 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-12-10 01:07:04 +00:00
David Heinemeier Hansson
2e47db2fbd
Fixed that habtm associations should be able to set :select as part of their definition and have that honored [DHH]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8313 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-12-05 21:53:53 +00:00
David Heinemeier Hansson
2af36bbbd4
Fix typos ( closes #10378 )
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8301 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-12-05 18:54:41 +00:00
Michael Koziarski
e302759451
Make reset return nil when using a dangling belongs_to association. Current 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
2007-11-29 02:19:10 +00:00
Jeremy Kemper
440f2890af
Dynamic finders on association collections respect association :limit. Closes #10227 [Jack Danger Canty]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8178 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-11-21 07:32:44 +00:00
Michael Koziarski
7d459203ee
Make Dynamic Finders on Association Collections Respect Association :order [patrick.t.joyce, technoweenie]. Closes #10211
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8174 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-11-21 01:51:57 +00:00
Rick Olson
3104291322
Fix HasManyThrough Association so it uses :conditions on the HasMany Association. Closes #9729 [danger]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8128 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-11-11 01:03:43 +00:00