Skip to content

Instantly share code, notes, and snippets.

@pseudomuto
Last active December 21, 2015 12:38
Show Gist options
  • Save pseudomuto/6306995 to your computer and use it in GitHub Desktop.
Save pseudomuto/6306995 to your computer and use it in GitHub Desktop.
Rails Secret Initializer Script. I use this file in `config/initializers/secret_token.rb`
def secure_token
token_file = Rails.root.join(".secret")
unless File.exists?(token_file)
system("rake secret >> #{token_file}")
end
File.read(token_file).chomp
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment