class RemindersController < ApplicationController
def create
zone = ActiveSupport::TimeZone[current_member.time_zone]
local_time = zone.parse(params.require(:reminder).fetch(:scheduled_for))
Reminder.create!(member: current_member, scheduled_for: local_time.utc)
class PostsController < ApplicationController
def create
@post = current_member.posts.build(post_params)
if @post.save
flash.now[:notice] = 'Post created.'
module Api
module V1
class PostsController < BaseController
before_action :authenticate_user!
def create
class DependencyError < StandardError
attr_reader :context
def initialize(message, context = {})
@context = context
super(message)
class Order < ApplicationRecord
has_many :line_items, strict_loading: true
belongs_to :customer, strict_loading: true
def total_cents
line_items.sum { |li| li.quantity * li.unit_price_cents }
class Notification < ApplicationRecord
belongs_to :member
after_create_commit -> { broadcast_prepend_to stream_name, target: "notifications", partial: "notifications/notification", locals: { notification: self } }
after_update_commit -> { broadcast_replace_to stream_name, partial: "notifications/notification", locals: { notification: self } }
production:
adapter: postgresql
encoding: unicode
pool: <%= ENV.fetch("RAILS_MAX_THREADS", 5) %>
timeout: 5000
checkout_timeout: 5
class ProjectsController < ApplicationController
def create
@project = Project.new(project_params)
if @project.save
response.set_header('Turbo-Location', project_url(@project))
class AddMetadataToUsers < ActiveRecord::Migration[6.1]
def change
add_column :users, :metadata, :jsonb, default: {}, null: false
add_index :users, :metadata, using: :gin
end
end
class CircuitBreaker
def initialize(name, redis: Redis.current)
@name = name
@redis = redis
end