This repository has been archived by the owner on Feb 5, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2ba2c48
commit feeb6fc
Showing
8 changed files
with
141 additions
and
83 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,17 @@ | ||
source 'http://rubygems.org' | ||
|
||
# DEPENDENCIES | ||
gem 'activerecord', require: 'active_record' | ||
gem 'activesupport', require: 'active_support/core_ext/object/try' | ||
gem 'activerecord', '>= 3.0', require: 'active_record' | ||
gem 'activesupport', '>= 3.0', require: 'active_support/core_ext/object/try' | ||
|
||
# DEVELOPMENT | ||
gem 'jeweler' | ||
gem 'yard' | ||
gem 'RedCloth', require: 'redcloth' | ||
group :development do | ||
# DEVELOPMENT | ||
gem 'jeweler' | ||
gem 'yard' | ||
gem 'RedCloth', require: 'redcloth' | ||
|
||
# TEST | ||
gem 'rspec' | ||
group :test do | ||
# TEST | ||
gem 'rspec' | ||
gem 'factory_girl' | ||
end | ||
gem 'pg' | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,49 @@ | ||
GEM | ||
remote: http://rubygems.org/ | ||
specs: | ||
RedCloth (4.2.3) | ||
activemodel (3.0.3) | ||
activesupport (= 3.0.3) | ||
RedCloth (4.2.7) | ||
activemodel (3.0.9) | ||
activesupport (= 3.0.9) | ||
builder (~> 2.1.2) | ||
i18n (~> 0.4) | ||
activerecord (3.0.3) | ||
activemodel (= 3.0.3) | ||
activesupport (= 3.0.3) | ||
arel (~> 2.0.2) | ||
i18n (~> 0.5.0) | ||
activerecord (3.0.9) | ||
activemodel (= 3.0.9) | ||
activesupport (= 3.0.9) | ||
arel (~> 2.0.10) | ||
tzinfo (~> 0.3.23) | ||
activesupport (3.0.3) | ||
arel (2.0.7) | ||
activesupport (3.0.9) | ||
arel (2.0.10) | ||
builder (2.1.2) | ||
diff-lcs (1.1.2) | ||
factory_girl (1.3.3) | ||
git (1.2.5) | ||
i18n (0.5.0) | ||
jeweler (1.5.2) | ||
bundler (~> 1.0.0) | ||
jeweler (1.6.2) | ||
bundler (~> 1.0) | ||
git (>= 1.2.5) | ||
rake | ||
rake (0.8.7) | ||
rspec (2.4.0) | ||
rspec-core (~> 2.4.0) | ||
rspec-expectations (~> 2.4.0) | ||
rspec-mocks (~> 2.4.0) | ||
rspec-core (2.4.0) | ||
rspec-expectations (2.4.0) | ||
pg (0.11.0) | ||
rake (0.9.2) | ||
rspec (2.6.0) | ||
rspec-core (~> 2.6.0) | ||
rspec-expectations (~> 2.6.0) | ||
rspec-mocks (~> 2.6.0) | ||
rspec-core (2.6.4) | ||
rspec-expectations (2.6.0) | ||
diff-lcs (~> 1.1.2) | ||
rspec-mocks (2.4.0) | ||
tzinfo (0.3.24) | ||
yard (0.6.4) | ||
rspec-mocks (2.6.0) | ||
tzinfo (0.3.28) | ||
yard (0.7.2) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
RedCloth | ||
activerecord | ||
activesupport | ||
activerecord (>= 3.0) | ||
activesupport (>= 3.0) | ||
factory_girl | ||
jeweler | ||
pg | ||
rspec | ||
yard |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
require 'active_support/core_ext/module/aliasing' | ||
require 'active_record/connection_adapters/postgresql_adapter' | ||
|
||
# Patch the PostgreSQL adapter to recognize defaults on ENUM columns. | ||
|
||
class ActiveRecord::ConnectionAdapters::PostgreSQLColumn | ||
def initialize(name, default, sql_type = nil, null = true) | ||
super(name, self.class.extract_value_from_default(default, sql_type), sql_type, null) | ||
end | ||
|
||
def self.extract_value_from_default_with_enum(default, type) | ||
case default | ||
when /\A'(.*)'::(?:#{Regexp.escape type})\z/ | ||
$1 | ||
else | ||
extract_value_from_default_without_enum default | ||
end | ||
end | ||
|
||
class << self | ||
alias_method_chain :extract_value_from_default, :enum | ||
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
require 'factory_girl' | ||
Factory.sequence(:enum_field) { |i| :"field#{i}" } |
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