Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@francescob
francescob / encrypted_credentials_read.rb
Last active June 28, 2021 19:38
access rails 5.2 encrypted credentials from a script outside the rails app
#First of all, require all of rails (maybe it doesn't need to be all, but for now it is)
require 'rails/all'
#then i need to slightly overwrite a rails method:
def encrypted(path, key_path: "config/master.key", env_key: "RAILS_MASTER_KEY")
ActiveSupport::EncryptedConfiguration.new(
config_path: path,
key_path: key_path,
/var/folders/t2/bgy0lrr56cv01cxt2p1j5z3h0000gn/T/ruby-build.20141030141254.21174 ~
HTTP/1.1 200 OK
Content-Type: binary/octet-stream
Content-Length: 503012
Connection: keep-alive
Date: Tue, 28 Oct 2014 07:23:29 GMT
Last-Modified: Fri, 23 May 2014 08:48:21 GMT
ETag: "5fe00cda18ca5daeb43762b80c38e06e"
Accept-Ranges: bytes
Server: AmazonS3
<h1 id="label-.belongs_to">.belongs_to</h1>
<p>(from gem activerecord-2.3.14)</p>
<h3 id="label-Implementation+from+ActiveRecord%3A%3AAssociations%3A%3AClassMethods">Implementation from ActiveRecord::Associations::ClassMethods</h3>
<hr style="height: 1px">
<pre>belongs_to(association_id, options = {})</pre>
<hr style="height: 1px">
def prova
end