Skip to content

Instantly share code, notes, and snippets.

@mikesmayer
mikesmayer / gist:77ecf97c678edee3d82b
Created May 19, 2015 19:21
logs from running # ruby -Itest test/unit/user_test.rb
# Running:
D, [2015-05-19T14:59:16.415164 #62298] DEBUG -- : (1.3ms) ALTER TABLE "addresses" DISABLE TRIGGER ALL;ALTER TABLE "albums" DISABLE TRIGGER ALL;ALTER TABLE "campaigns" DISABLE TRIGGER ALL;ALTER TABLE "clientlist_services" DISABLE TRIGGER ALL;ALTER TABLE "clientlists" DISABLE TRIGGER ALL;ALTER TABLE "clientreviews" DISABLE TRIGGER ALL;ALTER TABLE "avatars" DISABLE TRIGGER ALL;ALTER TABLE "authentications" DISABLE TRIGGER ALL;ALTER TABLE "descriptions" DISABLE TRIGGER ALL;ALTER TABLE "descriptors" DISABLE TRIGGER ALL;ALTER TABLE "emails" DISABLE TRIGGER ALL;ALTER TABLE "gotomarkets" DISABLE TRIGGER ALL;ALTER TABLE "deals" DISABLE TRIGGER ALL;ALTER TABLE "group_categories" DISABLE TRIGGER ALL;ALTER TABLE "group_links" DISABLE TRIGGER ALL;ALTER TABLE "identities" DISABLE TRIGGER ALL;ALTER TABLE "leadlist_origins" DISABLE TRIGGER ALL;ALTER TABLE "leadlist_shares" DISABLE TRIGGER ALL;ALTER TABLE "libraries" DISABLE TRIGGER ALL;ALTER TABLE "mdfs" DISABLE TRIGGER ALL;ALTER TABLE "mdfs_services" DISABLE
platforms :ruby do # linux
gem 'unicorn'
gem 'unicorn-rails'
end
platforms :mingw, :mswin, :x64_mingw do
gem 'tzinfo-data'
end
2015-04-17T02:47:14.764801+00:00 app[web.2]: Parameters: {"id"=>"5"}
2015-04-17T02:47:14.789693+00:00 app[web.2]: ActiveRecord::StatementInvalid (PG::UndefinedTable: ERROR: relation "descriptors" does not exist
2015-04-17T02:47:14.789705+00:00 app[web.2]: WHERE a.attrelid = '"descriptors"'::regclass
2015-04-17T02:47:14.789703+00:00 app[web.2]: ON a.attrelid = d.adrelid AND a.attnum = d.adnum
2015-04-17T02:47:14.789654+00:00 app[web.2]:
2015-04-17T02:47:14.789695+00:00 app[web.2]: LINE 5: WHERE a.attrelid = '"descriptors"'::regclass
2015-04-17T02:47:14.789702+00:00 app[web.2]: FROM pg_attribute a LEFT JOIN pg_attrdef d
2015-04-17T02:47:14.789706+00:00 app[web.2]: AND a.attnum > 0 AND NOT a.attisdropped
2015-04-17T02:47:14.789708+00:00 app[web.2]: ORDER BY a.attnum
2015-04-17T02:47:14.789700+00:00 app[web.2]: pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod
@mikesmayer
mikesmayer / gist:90fd534caed760e88a23
Created April 16, 2015 22:59
error when running migration on heroku
$ heroku run rake db:migrate
Running `rake db:migrate` attached to terminal... up, run.6428
ActiveRecord::SchemaMigration Load (5.6ms) SELECT "schema_migrations".* FROM "schema_migrations"
Migrating to AddIndexesToDescriptions (20150416153115)
(0.7ms) BEGIN
== 20150416153115 AddIndexesToDescriptions: migrating =========================
-- add_index(:descriptions, [:descriptor_id, :describable_id])
(2.2ms) CREATE INDEX "index_descriptions_on_descriptor_id_and_describable_id" ON "descriptions" ("descriptor_id", "describable_id")
PG::UndefinedTable: ERROR: relation "descriptions" does not exist
: CREATE INDEX "index_descriptions_on_descriptor_id_and_describable_id" ON "descriptions" ("descriptor_id", "describable_id")
@mikesmayer
mikesmayer / gist:63bb4830ff8190d20c83
Created April 14, 2015 16:14
current search box
<tr role="row" class="filter">
<td></td>
<td></td>
<td><input type="text" class="form-control form-filter input-sm" name="attribute_id"></td>
<td><input type="text" class="form-control form-filter input-sm" name="attribute_name"></td>
<td>
I, [2015-04-14T11:48:38.380398 #45411] INFO -- : Processing by PartnerMgmt::Vendoradmin::CategoryPlanningController#index as JSON
I, [2015-04-14T11:48:38.380567 #45411] INFO -- : Processing by PartnerMgmt::Vendoradmin::CategoryPlanningController#index as JSON
I, [2015-04-14T11:48:38.383617 #45411] INFO -- : Parameters: {"draw"=>"1", "columns"=>{"0"=>{"data"=>"0", "name"=>"", "searchable"=>"true", "orderable"=>"false", "search"=>{"value"=>"", "regex"=>"false"}}, "1"=>{"data"=>"1", "name"=>"", "searchable"=>"true", "orderable"=>"true", "search"=>{"value"=>"", "regex"=>"false"}}, "2"=>{"data"=>"2", "name"=>"", "searchable"=>"true", "orderable"=>"true", "search"=>{"value"=>"", "regex"=>"false"}}, "3"=>{"data"=>"3", "name"=>"", "searchable"=>"true", "orderable"=>"true", "search"=>{"value"=>"", "regex"=>"false"}}, "4"=>{"data"=>"4", "name"=>"", "searchable"=>"true", "orderable"=>"true", "search"=>{"value"=>"", "regex"=>"false"}}, "5"=>{"data"=>"5", "name"=>"", "searchable"=>"true", "orderable"=>"true", "search
@mikesmayer
mikesmayer / gist:177b47ff03a68bfcb9a4
Created April 12, 2015 01:14
failed db:seed log
User Load (2.1ms) SELECT "users".* FROM "users" WHERE "users"."email" IS NULL LIMIT 1
(1.7ms) BEGIN
SQL (379.1ms) INSERT INTO "users" ("email", "confirmed_at", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id" [["email", nil], ["confirmed_at", "2015-04-12 00:59:27.085155"], ["created_at", "2015-04-12 00:59:27.105191"], ["updated_at", "2015-04-12 00:59:27.105191"]]
PG::NotNullViolation: ERROR: null value in column "email" violates not-null constraint
DETAIL: Failing row contains (41, null, , null, null, null, 0, null, null, null, null, 2015-04-12 00:59:27.105191, 2015-04-12 00:59:27.105191, null, 2015-04-12 00:59:27.085155, null, null, null, null, null, null, null, null, null, null, 0, null).
: INSERT INTO "users" ("email", "confirmed_at", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id"
(1.8ms) ROLLBACK
rake aborted!
ActiveRecord::StatementInvalid: PG::NotNullViolation: ERROR: null value in column "email" violates not-null constraint
DETAIL: Failing row c
module HasRelations
module ClassMethods
def has_relations
include InstanceMethods
has_many :relations, :as => :from
end
end
module InstanceMethods
def related(relation_type = nil)
module HasRelations
module ClassMethods
def has_relations
include InstanceMethods
has_many :relations, :as => :from
end
end
module InstanceMethods
def related(relation_type = nil)
module RelationExtensions
extend ActiveSupport::Concern
included do
# -- Constants ------------------------------------------------------------
# -- Attributes -----------------------------------------------------------
attr_accessor :relation_identifier, :relation_position
# -- AR Extensions --------------------------------------------------------