aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/time/infinite_comparable.rb
diff options
context:
space:
mode:
authorOlek Janiszewski <olek.janiszewski@gmail.com>2013-02-26 03:06:35 +0100
committerOlek Janiszewski <olek.janiszewski@gmail.com>2013-05-03 16:18:37 +0200
commit534030cf83b078b10c08ffb587cc56e86773ea8c (patch)
tree2799ffd79b545dc6e910fd8acb6d86529782ca5e /activesupport/lib/active_support/core_ext/time/infinite_comparable.rb
parent6023a5049172e2222181881679b56c0e29034c96 (diff)
downloadrails-534030cf83b078b10c08ffb587cc56e86773ea8c.tar.gz
rails-534030cf83b078b10c08ffb587cc56e86773ea8c.tar.bz2
rails-534030cf83b078b10c08ffb587cc56e86773ea8c.zip
Do not overwrite manually built records during one-to-one nested attribute assignment
For one-to-one nested associations, if you build the new (in-memory) child object yourself before assignment, then the NestedAttributes module will not overwrite it, e.g.: class Member < ActiveRecord::Base has_one :avatar accepts_nested_attributes_for :avatar def avatar super || build_avatar(width: 200) end end member = Member.new member.avatar_attributes = {icon: 'sad'} member.avatar.width # => 200
Diffstat (limited to 'activesupport/lib/active_support/core_ext/time/infinite_comparable.rb')
0 files changed, 0 insertions, 0 deletions