Skip to content

Instantly share code, notes, and snippets.

View bolpin's full-sized avatar

Brian bolpin

View GitHub Profile
@bolpin
bolpin / dog_builder.rb
Created November 10, 2020 20:39
Build object attributes using a hash and a related object to build that hash
require 'active_model'
require 'active_support'
class Dog
include ActiveModel::Model
attr_accessor :name, :age
def self.build(attr_hash)
Dog.new DogBuilder.attributes(attr_hash)
end
console.log("hello from gist file");