This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Migration... | |
class AddFeatureFlagsToUsers < ActiveRecord::Migration[5.2] | |
def change | |
add_column :users, :feature_flags, :string, array: true, default: [] | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.card { | |
@apply bg-white shadow rounded-lg; | |
@media print { | |
@apply shadow-none; | |
} | |
} | |
.card-header { | |
@apply bg-gray-100 border-b border-gray-200 h-16 px-4 rounded-lg rounded-b-none flex justify-between items-center; | |
@media print { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
assert_difference(Stock.value, +100) do | |
stock.increment | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Trashable | |
extend ActiveSupport::Concern | |
included do | |
scope :trashed, ->{ unscope(where: :trashed_at).where.not(trashed_at: nil) } | |
scope :without_trashed, ->{ where(trashed_at: nil) } | |
scope :with_trashed, ->{ unscope(where: :trashed_at) } | |
default_scope { without_trashed } | |
# TODO: scope for items older than 30 days for reaping by the rake task: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Archivable | |
extend ActiveSupport::Concern | |
included do | |
scope :archived, ->{ unscope(where: :archived_at).where.not(archived_at: nil) } | |
scope :without_archived, ->{ where(archived_at: nil) } | |
scope :with_archived, ->{ unscope(where: :archived_at) } | |
default_scope { without_archived } | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# == Schema Information | |
# | |
# Table name: activities | |
# | |
# id :uuid not null, primary key | |
# user_id :uuid | |
# tenant_id :uuid | |
# trackable_type :string | |
# trackable_id :uuid |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/controllers/application_controller.rb | |
class ApplicationController < ActionController::Base | |
before_action :authenticate_user! | |
include CurrentTenant | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Let's simulate a DripService object that will give us some output: | |
class DripService | |
include ActiveModel::Model | |
attr_accessor :entry | |
def call | |
print "You passed in an entry: #{entry.email}" | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# == Schema Information | |
# | |
# Table name: identities | |
# | |
# id :integer not null, primary key | |
# user_id :integer | |
# provider :string | |
# uid :string | |
# created_at :datetime not null | |
# updated_at :datetime not null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div id="app"> | |
<p>{{ message }}</p> | |
</div> | |
</template> | |
<script> | |
export default { | |
data: function () { | |
return { |