This website requires JavaScript.
Explore
Help
Sign in
kotovalexarian-likes-github
/
rails--rails
Watch
1
Star
0
Fork
You've already forked rails--rails
0
mirror of
https://github.com/rails/rails.git
synced
2022-11-09 12:12:34 -05:00
Code
Releases
Activity
9617db2078
rails--rails
/
activerecord
/
test
/
models
/
student.rb
5 lines
96 B
Ruby
Raw
Normal View
History
Unescape
Escape
Fixing ordering of HABTM association deletion [#6191 state:resolved] Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-04 15:34:44 -05:00
class
Student
<
ActiveRecord
::
Base
has_and_belongs_to_many
:lessons
Fix error when using `with_options` with lambda. It was causing error when using `with_options` passing a lambda as its last argument. class User < ActiveRecord::Base with_options dependent: :destroy do |assoc| assoc.has_many :profiles, -> { where(active: true) } end end It was happening because the `option_merger` was taking the last argument and checking if it was a Hash. This breaks the HasMany usage, because its last argument can be a Hash or a Proc. As the behavior described in this test: https://github.com/rails/rails/blob/master/activesupport/test/option_merger_test.rb#L69 the method will only accept the lambda, this way it will keep the expected behavior. See 9eaa0a34
2014-04-02 18:27:55 -04:00
belongs_to
:college
Fixing ordering of HABTM association deletion [#6191 state:resolved] Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-04 15:34:44 -05:00
end
Copy permalink