Pratik Naik
fe6ffce51d
Make sure inner scope conditions get a preference over the outer ones
2009-01-24 17:54:10 +00:00
Frederick Cheung
5cebe69e74
Preload uses exclusive scope [ #643 state:resolved]
...
With self referential associations, the scope for the the top level should not affect fetching of associations, for example
when doing
Person.male.find :all, :include => :friends
we should load all of the friends for each male, not just the male friends.
2008-12-26 18:25:55 +00:00
Frederick Cheung
b17b9371c6
Fix configure_dependency_for_has_many not quoting conditions properly [ #1461 state:resolved]
2008-12-21 15:57:48 +00:00
Matt Jones
a9422cc1db
Fix preloading of has_one :through associations on belongs_to [ #1507 state:resolved]
...
Signed-off-by: Frederick Cheung <frederick.cheung@gmail.com >
2008-12-18 19:19:36 +00:00
miloops
97403ad5fd
Add :having option to find, to use in combination with grouped finds. Also added to has_many and has_and_belongs_to_many associations.
...
Signed-off-by: Michael Koziarski <michael@koziarski.com >
[#1028 state:committed]
2008-12-01 20:22:31 +01:00
Tom Stuart
32cb2345a5
Fix default_scope to work in combination with named scopes
...
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com >
2008-11-17 22:00:14 +01:00
Pratik Naik
2530d0eea8
Added default_scope to Base [ #1381 state:committed] (Paweł Kondzior)
2008-11-16 23:36:41 +05:30
David Heinemeier Hansson
ca23287b44
Revert "Added default_scope to Base [ #1381 state:committed] (Paweł Kondzior)" -- won't gel with threads.
...
This reverts commit ff594b2bc9 .
2008-11-16 16:35:52 +01:00
David Heinemeier Hansson
ff594b2bc9
Added default_scope to Base [ #1381 state:committed] (Paweł Kondzior)
2008-11-16 16:01:18 +01:00
Matt Jones
d3fd997109
fix assignment to has_one :through associations.
...
Signed-off-by: Michael Koziarski <michael@koziarski.com >
2008-11-15 18:20:39 +01:00
Pratik Naik
95c609357e
Ensure association proxy responds to private class methods defined in associated class. [ #1083 ]
2008-10-16 23:17:49 +02:00
Pratik Naik
691aa20280
Ensure methods called on association proxies respect access control. [ #1083 state:resolved] [Adam Milligan, Pratik]
2008-10-13 19:02:34 +02:00
Will Bryant
4c05055487
explicitly including child associations that are also included in the parent association definition should not result in double records in the collection/double loads ( #1110 )
...
Signed-off-by: Michael Koziarski <michael@koziarski.com >
[#1110 state:committed]
2008-10-10 16:58:39 +02:00
Zach Dennis
95e1cf4812
Fix has_many :through when the source is a belongs_to association. [ #323 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com >
2008-10-04 17:49:39 +01:00
Rich Cavanaugh
113de01eaf
Allow for the dirty tracking to work with the aliased name of aliased attributes.
...
Signed-off-by: Michael Koziarski <michael@koziarski.com >
[#812 state:committed]
2008-09-13 11:41:14 +02:00
miloops
646b5bfa61
Use select and change test so new tests can work on postgres.
...
Signed-off-by: Michael Koziarski <michael@koziarski.com >
2008-09-12 12:27:03 +02:00
miloops
a37c5ae961
Improve test coverage when using the group option in find, has_many or has_and_belongs_to_many.
...
Signed-off-by: Michael Koziarski <michael@koziarski.com >
2008-09-11 22:51:57 +02:00
Pratik Naik
9994f0d902
Revert "Add :accessible option to Associations for allowing mass assignments using hash. [ #474 state:resolved]"
...
This reverts commit e0750d6a5c .
Conflicts:
activerecord/CHANGELOG
activerecord/lib/active_record/associations.rb
activerecord/lib/active_record/associations/association_collection.rb
2008-09-10 18:50:01 +01:00
Rob Anderton
2cee51d5c1
Added :constructor and :converter options to composed_of and deprecated the conversion block
...
Signed-off-by: Michael Koziarski <michael@koziarski.com >
2008-09-10 18:28:47 +02:00
Tarmo Tänav
7c9851dbb6
Support :limit on update_all so that has_many with :limit can be safely updated
...
Signed-off-by: Michael Koziarski <michael@koziarski.com >
2008-09-10 13:41:49 +02:00
Tarmo Tänav
52ac9d0444
Fixed ordering in test_find_in_association_with_custom_finder_sql_and_multiple_interpolations
2008-08-22 10:39:45 +03:00
Philip Hallstrom
49c0e1e594
Fix generated WHERE IN query for named scopes. [ #583 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com >
2008-08-21 16:11:28 +01:00
Tarmo Tänav
96607996ea
Test for eager loading of STI subclasses from htm associations
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com >
2008-08-16 22:26:11 +01:00
Tarmo Tänav
656f0e7c6c
Fix file permissions
...
Signed-off-by: Joshua Peek <josh@joshpeek.com >
2008-07-31 16:36:23 -05:00
Daniel Guettler
c67713a2fe
Use klass.sti_name to make sure associations take store_full_sti_class into account. [ #671 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com >
2008-07-22 01:24:47 +01:00
David Dollar
e0750d6a5c
Add :accessible option to Associations for allowing mass assignments using 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 >
2008-07-14 02:53:21 +01:00
Daniel Guettler
84af99e78d
Ensure NamedScope#build/create/create!/new works as expected when named scope has hash conditions. [Daniel Guettler, Pratik Naik] [ #419 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com >
2008-07-09 14:09:17 +01:00
Brad Greenlee
afa0c7f728
Add support for :primary_key option to has_one as well as has_many so that a key other than the default primary key can be used for the association
...
Signed-off-by: Michael Koziarski <michael@koziarski.com >
2008-07-06 20:25:10 +02:00
Andre Arko
3351d29970
Add has_many :primary_key option to allow setting the primary key on a has many association
...
Signed-off-by: Michael Koziarski <michael@koziarski.com >
2008-07-06 20:25:10 +02:00
Pratik Naik
9a25315076
Add extra hash conditions tests for named_scope
2008-06-28 01:57:32 +01:00
Mark Catley
0fd3e4cd2b
Fix column collision with named_scope and :joins. [ #46 state:resolved]
2008-06-22 19:21:15 -07:00
Tarmo Tänav
1afae84ab2
Fixed that scopes defined with a string name could not be composed
2008-06-22 17:26:00 -07:00
rick
10c581a6de
fix merge
2008-06-19 09:59:36 -07:00
Pratik Naik
71bf756ea2
Disable validations for associated belongs_to record by default
2008-06-11 12:39:56 +01:00
Jan De Poorter
7f140bbdda
Add :validate option to associations. [ #301 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com >
2008-06-11 12:21:57 +01:00
Brandon Keepers
e94e53f9cd
fix eager loading with dynamic finders
2008-06-09 12:05:20 -04:00
Michael Koziarski
6277fd9113
Fix faulty tests introduced in 8d0b4fa39
2008-05-24 18:34:59 +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
Rodrigo Kochenburger
bca8751e40
Add ActiveRecord option to store the full class name on STI's type column, allowing one to have STI subclasses in different namespaces [ #114 ]
...
Signed-off-by: rick <technoweenie@gmail.com >
2008-05-13 15:04:11 -07:00
Xavier Noria
593e21d6ae
Dirty attributes aren't cleared if save fails. [ #174 state:resolved]
...
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2008-05-12 17:04:17 -07:00
Frederick Cheung
3f0dccbbc7
Ensure hm:t preloading honours reflection options. [ #137 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com >
2008-05-11 20:01:14 +01:00
Alex MacCaw
4cc594bd70
Fix validates_uniqueness_of for SQL keywords [ #23 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com >
2008-05-11 19:30:03 +01: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
Frederick Cheung
fbebdb0c09
Ensure correct record is returned when preloading has_one where more than one row exists
...
Signed-off-by: Michael Koziarski <michael@koziarski.com >
[#73 state:closed]
2008-05-06 21:08:52 +12:00
David Heinemeier Hansson
ab4d455d6d
Added missing files
2008-05-01 15:03:16 -05:00
David Heinemeier Hansson
6f20efdaf7
Fixed AssociationsPreload such that it doesnt require foreign keys to be integers (fcheung) [ #33 state:resolved]
2008-04-30 23:30:50 -05:00
David Heinemeier Hansson
874603ce8d
Change tests against all scope to base scope as all is now used as a finder alias
2008-04-30 00:25:52 -05:00
Frederick Cheung
44d2142352
Ensure table names are quoted by the association preloading code.
...
[#45 state:resolved]
Signed-off-by: Michael Koziarski <michael@koziarski.com >
2008-04-26 12:14:50 +12:00
Josh Peek
4b68982f64
Improve ActiveRecord::Base#table_name unit tests for nested classes. Closes #10289 . [scott_willson]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9237 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-07 19:44:37 +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