Skip to content

Instantly share code, notes, and snippets.

View bogdan's full-sized avatar

Bogdan Gusiev bogdan

View GitHub Profile
require 'active_record'
require 'ar_after_transaction/version'
module ARAfterTransaction
module ClassMethods
def self.extended( base )
base.class_eval do
class << self
alias_method :transaction_without_after, :transaction
alias_method :transaction, :transaction_with_after
require 'active_support/core_ext/hash/except'
require 'active_support/core_ext/module/introspection'
module ActiveModel
class Name
include Comparable
attr_reader :singular, :plural, :element, :collection,
:singular_route_key, :route_key, :param_key, :i18n_key,
:name
def feedback(feedback, user)
@feedback = feedback
@user = user
@is_spam = @feedback.is_spam?
bcc = "alexey+feedback@curebit.com" if @is_spam
mail(
subject: (@is_spam ? "[POSSIBLE SPAM]" : "") + "Curebit Feedback from #{@feedback.email}",
from: @feedback.email.presence || SUPPORT_ACCOUNT,
to: curebit_sales_address('feedback'),
bcc: bcc,
Value for params[:order][:discount_codes] was set to nil, because it was one of [], [null] or [null, null, ...]. Go to http://guides.rubyonrails.org/security.html#unsafe-query-generation for more information.
Value for params[:order][:note_attributes] was set to nil, because it was one of [], [null] or [null, null, ...]. Go to http://guides.rubyonrails.org/security.html#unsafe-query-generation for more information.
Value for params[:order][:tax_lines] was set to nil, because it was one of [], [null] or [null, null, ...]. Go to http://guides.rubyonrails.org/security.html#unsafe-query-generation for more information.
Value for params[:order][:line_items][:properties] was set to nil, because it was one of [], [null] or [null, null, ...]. Go to http://guides.rubyonrails.org/security.html#unsafe-query-generation for more information.
Value for params[:order][:line_items][:tax_lines] was set to nil, because it was one of [], [null] or [null, null, ...]. Go to http://guides.rubyonrails.org/security.html#unsafe-query
%table.action_table.table.table-striped.table-bordered
%thead.header
%tr
%th{style: "width: 210px", rowspan: 2} Email Type
%th{style: "width: 75px", rowspan: 2} Sent
%th{colspan: 2} Delivered
%th{colspan: 2} Opened
%th{colspan: 2} Clicked
%th{colspan: 2} Complained
%tr
Androgyny
Artifact Uprising
Classroom Friendly Supplies
Dinner Detective
FIGS
GoodWood NYC
Hired
Hired
Hired
Hired
module ActiveSupport
module Testing
class SimpleStubs # :nodoc:
Stub = Struct.new(:object, :method_name, :original_method)
def initialize
@stubs = {}
end
def stub_object(object, method_name, return_value)
require 'find'
namespace :db do desc "Backup the database to a file. Options: DIR=base_dir RAILS_ENV=development MAX=20"
task backup: [:environment] do
if Rails.env.production? || ENV['force_backup']
ENV['backup_base'] = get_backup_base
backup_file = File.join(get_backup_folder, "#{Rails.env}_dump.sql.gz")
db_config = ActiveRecord::Base.configurations[Rails.env]
class SummaryGrid < CurebitDatagrid
attr_accessor :site, :campaigns_filter
include Rails.application.routes.url_helpers
scope { Array.new }
filter(:referral_status, :enum, select: Referral::STATUSES, multiple: true,
default: [Referral::PENDING, Referral::APPROVED], dummy: true)
# These are not actual filters, I'm just abusing the feature to render date pickers
+-------------------------+---------------------+-----------------------------------------------------------------------------------+
| 0 | 1 | 2 |
+-------------------------+---------------------+-----------------------------------------------------------------------------------+
| DoubleSidedDealCampaign | testnosocialshare | [{:all=>nil, :clicks=>135, :clicks_unique=>103, :visits=>92, :visits_unique=>67}] |
| StandaloneCampaign | testnosocialshare | [{:all=>nil, :clicks=>92, :clicks_unique=>76, :visits=>26, :visits_unique=>21}] |
| DoubleSidedDealCampaign | testwithsocialshare | [{:all=>nil, :clicks=>188, :clicks_unique=>171, :visits=>29, :visits_unique=>25}] |
| StandaloneCampaign | testwithsocialshare | [{:all=>nil, :clicks=>82, :clicks_unique=>66, :visits=>28, :visits_unique=>25}] |
+-------------------------+---------------------+-------------------------------------