Skip to content

Instantly share code, notes, and snippets.

#
# Cookbook Name:: delayed_job
# Recipe:: default
#
if ['solo', 'app', 'app_master'].include?(node[:instance_role])
# be sure to replace "app_name" with the name of your application.
run_for_app("maloca") do |app_name, data|
@robdimarco
robdimarco / loads_presenter.rb
Created September 29, 2011 00:58 — forked from r38y/loads_presenter.rb
Custom sorting rules and presenters
class LoadsPresenter
extend ActiveSupport::Memoizable
def loads; raise "Implement #loads in subclass"; end
memoize :loads
def each(&block)
loads.each(&block)
end
- if @profile.locations.empty?
.info-col.padding-sidegap10
%ul.unstyled
%li No Locations Specified
- elsif @profile.is_dynamic
.info-col
.alert.margin-topgap5.padding-gap10
%p.margin-gap0.dynamic-text
%span.inline-block You have chosen to display a dynamic serving area.
%br
UPDATE call_source_partners
SET affiliate_slug = params->>'affiliate_slug', category_id = (params->>'category_id')::integer;
class AddProfileIdToTestimonials < ActiveRecord::Migration
def change
add_column :testimonials, :profile_ids, :integer, array: true
reversible do |dir|
dir.up do
execute <<-SQL
update testimonials set profile_ids = (select array_agg(profiles.id) from profiles
where profiles.accounts_id = testimonials.account_id;)
SQL
CREATE VIEW v_dynamic_pricing_for_accounts AS
SELECT
dynamic_pricing_bid_infos.account_id,
case
when 'red' = ANY(array_agg(dynamic_pricing_bid_infos.exclusive_lead_status))
then 'red'
when 'yellow' = ANY(array_agg(dynamic_pricing_bid_infos.exclusive_lead_status))
then 'yellow'
else 'green'
end exclusive_lead_status,