This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Activate the gem you are reporting the issue against. | |
gem 'activerecord', '4.0.0' | |
require 'active_record' | |
require 'minitest/autorun' | |
require 'logger' | |
# Ensure backward compatibility with Minitest 4 | |
Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test) | |
# This connection will do for database-independent bug reports. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# In my Image Bank Rails App | |
class Payment < ActiveRecord::Base | |
default_scope :conditions => { :application => 'ImageBank' } | |
before_save { |p| p.application="ImageBank" } | |
end | |
# In my Live Performances Rails App | |
class Payment < ActiveRecord::Base | |
default_scope :conditions => { :application => 'LivePerformances' } | |
before_save { |p| p.application="LivePerformances" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module TabsHelper | |
# takes the block | |
def tabs_for(current_tab, &block) | |
yield Tab.new(current_tab, self) | |
end | |
class Tab | |
def initialize(current_tab, template) | |
@current_tab = current_tab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module OrdersHelper | |
# helper to determine the active order step given : | |
# 1. a params[:step] | |
# 2. if none, according to the order's state | |
def active_step | |
@active_step ||= if params[:step] | |
params[:step] | |
elsif %(opened).include? @order.state | |
"1start" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PseudoAR | |
def self.find(args) | |
new.tap do |ar| | |
# do some crazy SQL | |
end | |
end | |
def self.create(args) | |
new.tap do |ar| | |
# do some crazy validation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module RAAWS | |
ONE_NECESSARY_SEARCH_PARAM =%w< | |
Actor Artist AudienceRating Author | |
Brand BrowseNode Composer Conductor CityDirector | |
Keywords Manufacturer MusicLabel Neighborhood | |
Orchestra Power Publisher TextStream Title> | |
class ItemOperation < Operation | |
def self.lookup(item_id, index=nil, &block) | |
new.tap do |obj| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'mixology' | |
module Callback | |
def cost | |
spoon_required | |
super | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rubygems" | |
require "uninclude" | |
module Core | |
def save; "saved" end | |
end | |
module Dirty | |
def save; "clean + " + super end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Asset < ActiveRecord::Base | |
acts_as_taggable_on :tags, :people | |
# FIRST ATTEMPT | |
def tag_list=(new_tags) | |
set_tag_list_on('tags',new_tags.downcase) | |
end | |
def person_list=(new_tags) | |
set_tag_list_on('people',new_tags.downcase) |
OlderNewer