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
class Member | |
has_one :latest_activity, -> { from(Activity.latest_by_member, :activities) }, class_name: "Activity" | |
end | |
class Activity | |
scope :latest_by_member, -> { select("DISTINCT ON (member_id) *").order(:member_id, created_at: :desc) } | |
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
{ | |
"theme": "One Light", | |
"base_keymap": "Atom", | |
"buffer_font_family": "DejaVu Sans Mono", | |
"buffer_font_size": 16, | |
"ui_font_size": 16, | |
"auto_indent_on_paste": false, | |
"show_edit_predictions": false, | |
"show_whitespaces": "none", | |
"gutter": { "code_actions": false, "runnables": false, "breakpoints": false }, |
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 Element::Positionable | |
extend ActiveSupport::Concern | |
included do | |
before_create :set_position | |
before_update :reposition_before_update | |
validates_numericality_of :position, greater_than_or_equal_to: 1, on: :update | |
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
<%= form_with model: citizen, class: "card flex flex-col gap", data: { controller: "form" } do |form| %> | |
<div class="flex flex-col gap mb-2"> | |
<div class="flex flex-col gap-half"> | |
<% countries = Country.order(:name) %> | |
<%= label_tag :country_id, "Country", class: "text-sm font-medium leading-none" %> | |
<%= select_tag :country_id, options_from_collection_for_select(countries, :id, :name, citizen.country_id), include_blank: "Select one", class: "input", data: { action: "form#submit", form_submitter_param: "on_country_change" } %> | |
</div> | |
<div class="flex flex-col gap-half"> | |
<% states = State.where(country_id: citizen.country_id).order(:name) %> |
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
class TagBuilder | |
def initialize(context, tag_name, content = nil, klass: nil, default_attributes: {}, **attributes, &block) | |
@context = context | |
@tag_name = tag_name | |
@content = content | |
@klass = klass | |
@default_attributes = default_attributes | |
@attributes = attributes | |
@block = block | |
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
.tabs { | |
display: flex; | |
flex-direction: column; | |
gap: var(--size-2); | |
} | |
.tabs__list { | |
background-color: var(--color-border-light); | |
block-size: var(--size-10); | |
border-radius: var(--rounded-md); |
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 ApplicationHelper | |
def current_page_with_controllers?(controllers) | |
controllers.any? { |controller| current_page? controller: controller } | |
end | |
def current_page_with_actions?(actions) | |
actions.any? { |action| current_page? action: action } | |
end | |
def current_page_with_controllers_and_actions?(controllers, actions) |
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
<div data-controller="popover"> | |
<button class="btn" popovertarget="popover" data-popover-target="button"> | |
Open popover | |
</button> | |
<div popover id="popover" class="popover" data-popover-target="menu" data-action="beforetoggle->popover#update"> | |
<%= render "dimensions_form" %> | |
</div> | |
</div> |
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
class MedicalRecord < ApplicationRecord | |
enum kind: %i[ imaging results notes ] | |
belongs_to :patient, class_name: "User", inverse_of: :medical_records | |
has_one_attached :document, dependent: :detach | |
scope :with_kind, -> (kind) { where kind: kind } | |
after_create_commit :deliver_updation |
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
# config/database.yml | |
# SQLite. Versions 3.8.0 and up are supported. | |
# gem install sqlite3 | |
# | |
# Ensure the SQLite 3 gem is defined in your Gemfile | |
# gem "sqlite3" | |
# | |
default: &default | |
adapter: sqlite3 |
NewerOlder