1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Commit graph

19 commits

Author SHA1 Message Date
Pratik Naik
8ff2fb6f3a Make default_scope work with Relations 2010-01-23 13:41:09 +05:30
Pratik Naik
9e7ec2a9f1 Simplify calculation scope building. Remove :order from associations as it is troublesome w/ calculation methods using postgresql. 2010-01-18 23:40:42 +05:30
Pratik Naik
d60bb0a9e4 Rename named_scope to scope 2010-01-18 04:38:19 +05:30
Pratik Naik
dca3de3bc7 Make relations work as scopes 2010-01-17 23:22:11 +05:30
Pratik Naik
f0cde5be54 Make sure named_scope names are not used as method names already 2010-01-17 21:34:41 +05:30
mattbauer
83c1934003 Ensure hm:t#create respects source associations hash conditions [#2090 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-06-21 17:35:04 +01:00
Diego Algorta
0dd2f96f5c Fixed bug that makes named_scopes _forgot_ current scope 2009-02-25 09:21:08 -08:00
Pratik Naik
fe6ffce51d Make sure inner scope conditions get a preference over the outer ones 2009-01-24 17:54:10 +00: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
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
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
Mark Catley
0fd3e4cd2b Fix column collision with named_scope and :joins. [#46 state:resolved] 2008-06-22 19:21:15 -07: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
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
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
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
355a8ff2cd Introduce preload query strategy for eager :includes. Closes #9640.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8672 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-19 04:19:53 +00:00
Jeremy Kemper
43b81d01d0 move assets and models
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8657 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-18 07:27:03 +00:00
Renamed from activerecord/test/fixtures/post.rb (Browse further)