Skip to content

Instantly share code, notes, and snippets.

View mecampbellsoup's full-sized avatar

Matt Campbell mecampbellsoup

View GitHub Profile
[24] pry(main)> u = User.first
User Load (0.8ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT $1 [["LIMIT", 1]]
#<User:0x007ff5557830c8> {
:id => "173e4d20-8487-4848-97b9-ef6fbd92ca78",
:email => "email",
:name => "matt",
:created_at => Fri, 22 Jul 2016 20:12:13 UTC +00:00,
:updated_at => Fri, 22 Jul 2016 20:12:13 UTC +00:00,
:email_verified_at => nil
}
class User < ApplicationRecord
validates :name, :email, presence: true
has_one :current_auth_token, class_name: AuthToken
#has_many :auth_tokens
has_many :sessions
has_many :credentials, through: :sessions
has_many :application_users
# Option 1 - sideload the Person owner
{
"data": {
"id": "{{profile.id}}",
"type": "profiles",
"relationships": {
"owner": {
"data": {
"id": "{{person.id}}",
"type": "person"
POST /v1/profiles?application_id=some-app-id
{
"data": {
"type": "profiles",
"relationships": {
"owner": {
"data": {
"type": "people",
"attributes": {
def included_relationships
[
(credentials.present? ? 'credentials' : nil),
(users.present? ? 'users' : nil)
].compact
end
@mecampbellsoup
mecampbellsoup / # vim - 2016-05-31_17-54-44.txt
Created May 31, 2016 21:56
vim on Mac OS X 10.11.5 - Homebrew build logs
Homebrew build logs for vim on Mac OS X 10.11.5
Build date: 2016-05-31 17:54:44
# in gatekeeper/app/models/credential.rb
# session.credential_id
# credential.session
def token_data
{
# registered claims
jti: "#{self.id}",
iss: "opentransact/v1",
sub: "session|#{session_id}",
iat: Time.now.utc,
# to be run from within a sandbox and production rails console instance
table_names = %w(
ach_file_transitions
ach_file_deliveries
ach_file_archives
ach_files
delivery_targets
batches
module Zipmark
module Actions
module Deposits
class UnmarkReturned
include Virtus.model
include ActiveModel::Validations
attribute :id, String
attribute :dry_run, Boolean
delivery_target = DeliveryTarget.new(delivery_target_params)
[1] pry(#<DeliveryTargetsController>)> delivery_target.connection_settings.class
=> ActionController::Parameters
[2] pry(#<DeliveryTargetsController>)> delivery_target.save!
TypeError: can't cast ActionController::Parameters
from /Users/mec/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/bundler/gems/rails-1ad94e760d7a/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb:40:in `rescue in type_cast'
[3] pry(#<DeliveryTargetsController>)> delivery_target.connection_settings = delivery_target.connection_settings.to_h
=> {"sftp_url"=>"sftp@foo.zipmark.com"}
[4] pry(#<DeliveryTargetsController>)> delivery_target.connection_settings.class