class CreateDefaultDomains < ActiveRecord::Migration - CreateDefaultDomains has no descriptive comment
class Domain < ActiveRecord::Base - CreateDefaultDomains::Domain has no descriptive comment
has_many :aliases,
-> { create_with(strip_extension: nil, strip_characters: nil) },
foreign_key: "canonical_domain_id", class_name: "Domain"
end
def up - CreateDefaultDomains#up doesn't depend on instance state (maybe move it to another class?)
gmail = Domain.create!(name: "gmail.com", strip_extension: "+", strip_characters: ".")
gmail.aliases.create!(name: "googlemail.com")
end
def down - CreateDefaultDomains#down doesn't depend on instance state (maybe move it to another class?)
Domain.delete_all
end
end