Skip to content

Instantly share code, notes, and snippets.

@9876691
Last active September 7, 2018 13:39
Show Gist options
  • Save 9876691/bc9be5550e3e3f301fff7bf61261d847 to your computer and use it in GitHub Desktop.
Save 9876691/bc9be5550e3e3f301fff7bf61261d847 to your computer and use it in GitHub Desktop.
class Bitcoins::Create < BrowserAction
route do
KeyPairForm.create(params, user_id: current_user.id) do |form, key_pair|
if key_pair
flash.info = "Bitcoin address successfully generated"
redirect to: Bitcoins::Index
else
flash.danger = "Unable to generate Bitcoin Address, Please try again."
addresses = KeyPairQuery.new.user_id(current_user.id).map{ |keypair|
{ keypair.label, keypair.public_key, "" }
}
render IndexPage, form: form, addresses: addresses
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment