Slide 36
Slide 36 text
• ActiveModel ϕʔεͷ ApplicationModel Ͱࣗલ࣮
Sync : attributes
class Admin::User < ApplicationModel
associate :user, User, default: -> { User.new }
attribute :name, :string, for: :user
validates_associated :user
def save
sync_attributes
return false unless valid?
user.save
end
end