Skip to content

Instantly share code, notes, and snippets.

View jsmestad's full-sized avatar
👾

Justin Smestad jsmestad

👾
View GitHub Profile
section.details dl {
$modal-detail-header-color: $blue !default;
$modal-detail-header-weight: 100 !default;
$modal-detail-body-bg-color: #FFF !default;
$modal-detail-body-padding: rem-calc(10) !default;
dt {
color: $modal-detail-header-color;
font-weight: $modal-detail-header-weight;
module GuidConcern
extend ActiveSupport::Concern
included do
before_validation :set_guid!, on: :create, if: :has_guid_concern?
validate :guid_concern_validator, if: :has_guid_concern?
end
module ClassMethods
def displayed_with_guid(options={})
= field_set_tag do
= f.input :title, placeholder: 'Friendly Name', required: true, disabled: (f.object.title.present?)
= field_set_tag 'IP Address Range' do
= f.input :starts_with, placeholder: 'IPv4 Address', required: true, as: :string
= f.input :ends_with, placeholder: 'IPv4 Address', required: true, as: :string
= field_set_tag 'Assessment Scope' do
= f.association :assessment_scope, collection: @account.assessment_scopes, required: true
require 'rails_helper'
RSpec.describe 'Domains Requests' do
describe 'GET /api/domains/{id}' do
it 'responds with the requested domain' do
domain = FactoryGirl.create(:domain)
get api_domain_path(domain)
class DomainSerializer
attributes :id, :name
# Override publicly-exposed ID to actually be GUID
def id
self.guid
end
end
class RecordSerializer
module ScopeConcern
extend ActiveSupport::Concern
included do
superclass.send(:define_singleton_method, "#{self.model_name.demodulize.underscore}_records") do
where(type: "#{self.class.name}")
end
end
end
{
"type": "object",
"required": ["domains"],
"properties": {
"domains" : {
"type": "array",
"items": {
"type" : "object",
"required" : [
"created_at",
{
"id": "http://jsonapi.org/schema#",
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "JSON API Schema",
"description": "This is a schema for responses in the JSON API format. For more, see http://jsonapi.org",
"type": "object",
"resources":{
"type": "array",
"items": {
"type": "object",
def current_user=(val)
session[:signed_token] = @user
@user = User.find(....)
@user.signing_token = session[:signed_token]
end
class User
#...
{
user: {
# .. existing stuff from update
permissions: {
'dns_manager': [],
'ctms': [],
'registrar': []
}
}
}