Module: HasOneAutocreate::InstanceMethods
- Defined in:
- lib/has_one_autocreate.rb
Instance Method Summary collapse
-
#reload ⇒ Object
TODO: Move to find_target once we’re in front of cache_fu.
Instance Method Details
#reload ⇒ Object
TODO: Move to find_target once we’re in front of cache_fu.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/has_one_autocreate.rb', line 23 def reload value = find_target if value @target = value elsif method = @reflection.send(:autocreate) @target = case method when true create! when Symbol, String self.send(method) when false # nop else # default # ActiveRecord::Associations::HasOneAssociation.autocreate end end loaded end |