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"
--
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 rubyonrails-co...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.