Skip to content

Instantly share code, notes, and snippets.

Scenario: user deletes a shoe on page 1 with multiple pages of results # features/user_delete_mykix.feature:20
Given I am logged in as a user # features/step_definitions/custom_steps.rb:26
And 25 saved shoes # features/step_definitions/custom_steps.rb:119
User(#29889530) expected, got User(#30010000) (ActiveRecord::AssociationTypeMismatch)
/Users/andrewkasper/Projects/SuperKix/trunk/vendor/plugins/object_daddy/lib/object_daddy.rb:31:in `new'
/Users/andrewkasper/Projects/SuperKix/trunk/vendor/plugins/object_daddy/lib/object_daddy.rb:31:in `spawn'
/Users/andrewkasper/Projects/SuperKix/trunk/vendor/plugins/object_daddy/lib/object_daddy.rb:210:in `generate!'
./features/step_definitions/custom_steps.rb:120:in `__instance_exec0'
./features/step_definitions/custom_steps.rb:120:in `times'
./features/step_definitions/custom_steps.rb:120:in `/^(\d+) saved shoe(s)?$/'
Given /^(\d+) saved shoe(s)?$/ do |n, garbage|
(n.to_i).times { ShoeSubscription.generate!(:user => @current_user) }
end
no such file to load -- /data/superkix/releases/20090511162922/config/../vendor/rails/railties/lib/initializer
@akasper
akasper / hpricot probs
Created May 19, 2009 21:31
Can't launch because of hpricot version problems
andrew-kaspers-macbook-pro-2:superkix andrewkasper$ ./script/server
=> Booting Mongrel (use 'script/server webrick' to force WEBrick)
=> Rails 2.1.0 application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails with development environment...
Exiting
/Library/Ruby/Site/1.8/rubygems.rb:149:in `activate': can't activate hpricot (= 0.6, runtime), already activated hpricot-0.8.1 (Gem::Exception)
from /Library/Ruby/Site/1.8/rubygems.rb:165:in `activate'
1)
NoMethodError in 'Seeder instance , attempting to create a record that violates class validations should not raise an error'
undefined method `first' for #<Hash:0x3974cb4>
./spec/models/seeder_spec.rb:26:
2)
NoMethodError in 'Seeder instance , attempting to create a record that violates class validations should not create the new record'
undefined method `first' for #<Hash:0x3970358>
./spec/models/seeder_spec.rb:26:
Cannot automatically map column type NilClass to an equivalent Sphinx
type (integer, float, boolean, datetime, string as ordinal). You could try to
explicitly convert the column's value in your define_index block:
has "CAST(column AS INT)", :type => :integer, :as => :column
/Users/andrewkasper/Projects/SuperKix/superkix/vendor/plugins/thinking-sphinx/lib/thinking_sphinx/attribute.rb:248:in `translated_type_from_database'
/Users/andrewkasper/Projects/SuperKix/superkix/vendor/plugins/thinking-sphinx/lib/thinking_sphinx/attribute.rb:148:in `type'
/Users/andrewkasper/Projects/SuperKix/superkix/vendor/plugins/thinking-sphinx/lib/thinking_sphinx/attribute.rb:113:in `type_to_config'
/Users/andrewkasper/Projects/SuperKix/superkix/vendor/plugins/thinking-sphinx/lib/thinking_sphinx/index.rb:290:in `set_source_attributes'
/Users/andrewkasper/Projects/SuperKix/superkix/vendor/plugins/thinking-sphinx/lib/thinking_sphinx/index.rb:289:in `each'
/Users/andrewkasper/Projects/SuperKix/superkix/vendor/plugins/thinking-sphinx/
^
/ o \
( | )
\ | /
'
if node[:instance_role] == 'util' && node[:instance_name].downcase = 'stats'
cron 'archive old logs' do
#cron stuff goes here
end
cron "process business statistics" do
#cron stuff goes here
end
cron "process publication statistics" do
require 'fastercsv'
class Page < ActiveRecord::Base
CSV_COLUMN_NAMES = ["Name", "Link", "Annual Value", "Potential Value", "Realized", "Likes Count", "Fans", "Comments Count","Fan Post Count", "Brand Post Count", "Brand Post Max of 60", "id", "Mulipler", "Category"]
# Generate a CSV File
# Expects a sort by field nand desc / asc
# Page.genreate_csv(:sidx => blah, :sord => blah, :rows => blah, :categories => blah)
def self.generate_csv(options = {})
options.symbolize_keys!
@akasper
akasper / graph_object.rb
Created December 22, 2010 20:11
I CAN HAZ LIKES COUNT
class Moderation::GraphObject
include Mongoid::Document
include Mongoid::Timestamps
before_save :flag_fb_comments_and_likes_counts_changes
after_save :update_fb_comments_and_likes_counts_on_dispatch!
include Moderation::Remover
include Moderation::Flagger
include Moderation::Stateful