Skip to content

Instantly share code, notes, and snippets.

View cmar's full-sized avatar

Chris Mar cmar

  • CustomInk
  • Northern, VA
  • X @cmar
View GitHub Profile
Processing by Admin::ConfigurationsController#index as HTML
SpreeMultiStoreConfiguration Load (0.2ms) SELECT "configurations".* FROM "configurations" WHERE "configurations"."type" IN ('SpreeMultiStoreConfiguration') AND "configurations"."name" = 'Default spree_multi_store configuration' LIMIT 1
CACHE (0.0ms) SELECT "configurations".* FROM "configurations" WHERE "configurations"."type" IN ('SpreeMultiStoreConfiguration') AND "configurations"."name" = 'Default spree_multi_store configuration' LIMIT 1
Store Load (0.2ms) SELECT "stores".* FROM "stores" WHERE (subdomain = 'store1') LIMIT 1
User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1057526567 LIMIT 1
Role Load (0.1ms) SELECT "roles".* FROM "roles" INNER JOIN "roles_users" ON "roles"."id" = "roles_users"."role_id" WHERE "roles_users"."user_id" = 1057526567
Property Load (0.1ms) SELECT "properties".* FROM "properties" WHERE "properties"."name" = 'brand' LIMIT 1
Rendered /Users/cmar/.rvm/gems/ruby-1.8.7-p352/bundler/gems/sp
@cmar
cmar / base_template.rb
Created October 8, 2011 13:50
Base Rails Template
gem 'devise'
gem "rspec-rails", :group => [ :development, :test ]
gem "factory_girl_rails", :group => [:test]
run 'bundle install'
generate "devise:install"
generate "devise", "User"
rake "db:migrate", :env => 'development'
rake "db:migrate", :env => 'test'
@cmar
cmar / site.rb
Created October 26, 2011 13:44
URL Validation
validates :url, :presence => true,
:format => { :with => URI::regexp(%w(http https)) },
:uniqueness => true
@cmar
cmar / spree_template.rb
Created November 1, 2011 13:07
Spree Template
gem 'spree'
gem "rspec-rails", :group => [ :development, :test ]
gem "factory_girl_rails", :group => [:test]
run 'bundle install'
remove_dir 'test'
generate 'rspec:install'
create_file 'spec/factories.rb' do
%q{FactoryGirl.define do
factory :user do
Gemfile:
gem 'rails', '3.1.3'
gem 'spree', :git => 'https://github.com/spree/spree.git'
gem 'spree_skrill', :git => 'git@github.com:spree/spree_skrill.git', :branch => 'v2'
bundle update:
Using spree_core (1.0.0.beta) from https://github.com/spree/spree.git (at master)
Using spree_auth (1.0.0.beta) from https://github.com/spree/spree.git (at master)
Using spree_api (1.0.0.beta) from https://github.com/spree/spree.git (at master)
Using spree_dash (1.0.0.beta) from https://github.com/spree/spree.git (at master)
require 'spree/core/preference_rescue'
class NewPreferences < ActiveRecord::Migration
def up
add_column :spree_preferences, :key, :string
add_column :spree_preferences, :value_type, :string
add_index :spree_preferences, :key, :unique => true
remove_index :spree_preferences, :name => 'ix_prefs_on_owner_attr_pref'
require 'spree/core/preference_rescue'
class NamespacePromoTables < ActiveRecord::Migration
def concat(str1, str2)
dbtype = Rails.configuration.database_configuration[Rails.env]['adapter'].to_sym
case dbtype
when :mysql, :mysql2
"CONCAT(#{str1}, #{str2})"
➜ spree_multi_db rake "spree_shared:bootstrap[store2]" @13b60b5(1.9.3@multi_db)
Did not trace ActionView::Template#rails_initialize because that method does not exist
[DEPRECATION WARNING] Nested I18n namespace lookup under "activerecord.attributes.spree/order" is no longer supported
Creating database: store2
Loading seed & sample data into database: store2
loading fixture /Users/cmar/.rvm/gems/ruby-1.9.3-p125@multi_db/bundler/gems/spree-95e6866064f7/sample/lib/tasks/../../db/sample/spree/addresses.yml
loading fixture /Users/cmar/.rvm/gems/ruby-1.9.3-p125@multi_db/bundler/gems/spree-95e6866064f7/sample/lib/tasks/../../db/sample/spree/adjustments.yml
loading fixture /Users/cmar/.rvm/gems/ruby-1.9.3-p125@multi_db/bundler/gems/spree-95e6866064f7/sample/lib/tasks/../../db/sample/spree/assets.yml
loading fixture /Users/cmar/.rvm/gems/ruby-1.9.3-p125@multi_db/bundler/gems/spree-95e6866064f7/sample/lib/
Spree::BaseController.class_eval do
ENV['DEFAULT_HTTPS_HOST'] = 'spreeworks.dev'
ENV['DEFAULT_HTTP_HOST'] = 'spreebeta.dev'
protected
def https_redirect_url
redirect_url_with_session('https', "#{ENV['RAILS_CACHE_ID']}.#{ENV['DEFAULT_HTTPS_HOST']}")
end
require 'spree_shared/apartment_elevator'
require 'action_dispatch'
require 'rails/rack/logger'
module Apartment
module Elevators
describe Subdomain do
before do
@env = double("env")