Skip to content

Instantly share code, notes, and snippets.

@osheroff
Created April 13, 2011 00:30
Show Gist options
  • Save osheroff/916741 to your computer and use it in GitHub Desktop.
Save osheroff/916741 to your computer and use it in GitHub Desktop.
def verification_link(account, user)
token = user.identities.first.verification_tokens.first || user.identities.first.verification_tokens.create
link = "#{account.url(:mapped => false)}/verification/email/#{token.value}"
end
account = nil
ActiveRecord::Base.on_shard(2) do
account = Account.new(:name => "Number Four", :size => 1, :time_zone => "Copenhagen") { |a|
a.subdomain = "shardly#{rand(150)}"
a.help_desk_size = "5-20"
a.shard_id = 2
a.set_owner(:name => "Shardly Do-Right", :email => "ben@gimbo.net")
a.set_address(:phone => "415-454-9014")
}
account.save!
owner_verification_link = verification_link(account, account.owner)
AccountsMailer.deliver_welcome_account_owner(account.owner, owner_verification_link)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment