Nope, If attribute has value, it is not initialized.

On Tuesday, May 10, 2016 at 12:20:03 PM UTC+9, Roque Pinel wrote:
>
> If the callback belonged to `Book`, would you re-run it with `becomes`? 
> Sounds confusing.
>
> On Mon, May 9, 2016 at 11:13 PM, 신재현 <[email protected] <javascript:>> 
> wrote:
>
>> I propose that initialize values in `becomes` method
>>
>> for example,
>>
>> class Book < ApplicationRecord
>> end
>>
>>
>> class PaperBook < Book
>>   after_initialize do |boo|
>>     material ||= "paper"
>>   end
>> end
>>
>>
>> > book = Book.new
>> > book.material
>> # => nil
>>
>>
>> > book.becomes!(PaperBook).materal
>> # => "paper"
>>
>> Shoul I implement the feature?
>> Does it make sense?
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Ruby on Rails: Core" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/rubyonrails-core.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Reply via email to