Skip to content

Instantly share code, notes, and snippets.

/Users/justin/.gem/ruby/2.1.2/gems/activerecord-4.1.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:541:in `retrieve_connection': ActiveRecord::ConnectionNotEstablished (ActiveRecord::ConnectionNotEstablished)
from /Users/justin/.gem/ruby/2.1.2/gems/activerecord-4.1.1/lib/active_record/connection_handling.rb:113:in `retrieve_connection'
from /Users/justin/.gem/ruby/2.1.2/gems/activerecord-4.1.1/lib/active_record/connection_handling.rb:87:in `connection'
from /Users/justin/.gem/ruby/2.1.2/gems/activerecord-4.1.1/lib/active_record/model_schema.rb:214:in `columns'
from /Users/justin/.gem/ruby/2.1.2/gems/activerecord-4.1.1/lib/active_record/model_schema.rb:260:in `column_names'
from /Users/justin/.gem/ruby/2.1.2/gems/rd_searchlogic-3.0.1/lib/searchlogic/named_scopes/ordering.rb:61:in `ordering_condition_details'
from /Users/justin/.gem/ruby/2.1.2/gems/rd_searchlogic-3.0.1/lib/searchlogic/named_scopes/ordering.rb:52:in `method_missing'
from /Users/justin/.gem/ruby/2.1.2/gems/spree_core-0
define("simple-auth-devise/authenticators/devise",
["simple-auth/authenticators/base","simple-auth/utils/is-secure-url","simple-auth/utils/get-global-config","exports"],
function(__dependency1__, __dependency2__, __dependency3__, __exports__) {
"use strict";
var Base = __dependency1__["default"];
var isSecureUrl = __dependency2__["default"];
var getGlobalConfig = __dependency3__["default"];
var global = (typeof window !== 'undefined') ? window : {},
Ember = global.Ember;
Fetching git://github.com/spree/spree.git
Cloning into bare repository '/Users/justin/.gem/ruby/2.0.0/cache/bundler/git/spree-4a1e30487ca922b2bea76d92542b0fa510a960ea'...
remote: Reusing existing pack: 167510, done.
remote: Counting objects: 1192, done.
remote: Compressing objects: 100% (707/707), done.
remote: Total 168702 (delta 579), reused 801 (delta 362)
Receiving objects: 100% (168702/168702), 39.57 MiB | 2.32 MiB/s, done.
Resolving deltas: 100% (93043/93043), done.
Checking connectivity... done.
Cloning into '/Users/justin/.gem/ruby/2.0.0/bundler/gems/spree-61013cc29bd3'...
Spree::UserRegistrationsController.class_eval do
layout "onboarding"
end
class Spree::Company < ActiveRecord::Base
belongs_to :vendor
belongs_to :state
belongs_to :country
belongs_to :trend_together
validates :name, presence: true, :if => :is_profile
validates :name, uniqueness: true, :if => :is_profile
validates :address, presence: true, :if => :is_profile
@j-mcnally
j-mcnally / engine.rb
Created July 2, 2014 03:29
Install migrations vs append migrations?
module Assetable
class Engine < ::Rails::Engine
config.generators.integration_tool :rspec
config.generators.test_framework :rspec
# Run the engine migrations with the main app rake task
initializer :append_migrations do |app|
unless app.root.to_s.match root.to_s
config.paths["db/migrate"].expanded.each do |expanded_path|
app.config.paths["db/migrate"] << expanded_path
Spree::User.class_eval do
has_many :state_changes, as: :stateful
assetable :image
def apply_omniauth(omniauth)
if ["facebook", 'google_oauth2'].include? omniauth['provider']
self.email = omniauth.fetch('info', {}).fetch('email', nil) if email.blank?
self.name = omniauth.fetch('info', {}).fetch('name', nil) if name.blank?
end
self.password = Devise.friendly_token[0,20] if password.blank?
@j-mcnally
j-mcnally / initializers-spree_social.rb
Created July 3, 2014 00:56
SpreeSocial bootstrap known credentials
# Ensure our environment is bootstrapped with a facebook connect app
if ActiveRecord::Base.connection.table_exists? 'spree_authentication_methods'
Spree::AuthenticationMethod.where(environment: Rails.env, provider: 'facebook').first_or_create do |auth_method|
auth_method.api_key = ENV['FACEBOOK_APP_ID']
auth_method.api_secret = ENV['FACEBOOK_APP_SECRET']
auth_method.active = true
end
end
>> fval
=> 0.06
>> send(:"plus_#{i}=", fval)
=> 0.06
>> send(:"plus_#{i}")
=> 0
class Model
attr_accessor :skip_callbacks
after_save :do_something
def do_something
unless skip_callbacks
# Do callback code.
end
end
end