Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Full activerecord >= 3.1 compatible #15

Merged
merged 2 commits into from

2 participants

@pyromaniac
Collaborator

Usage:

ACTIVERECORD_VERSION='~>3.1.0' DB=mysql rake spec

ACTIVERECORD_VERSION - any proper gem version >= 3.1
DB - sqlite, mysql, postgresql

Added travis.yml, not shure it's proper, but try please.

@jashmenn jashmenn merged commit 66c7bfb into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 10, 2012
  1. @pyromaniac

    Rails 3.1 full compatible

    pyromaniac authored
  2. @pyromaniac

    Added travis.yml

    pyromaniac authored
This page is out of date. Refresh to see the latest.
View
35 .travis.yml
@@ -0,0 +1,35 @@
+before_script:
+ - mysql -e 'create database activeuuid_test;'
+ - psql -c 'create database activeuuid_test;' -U postgres
+
+rvm:
+ - 1.9.2
+ - 1.9.3
+ #- ruby-head
+ #- rbx-19mode
+
+env:
+ - RAILS_VERSION='~>3.1.0'
+ - RAILS_VERSION='~>3.1.0' DB=mysql
+ - RAILS_VERSION='~>3.1.0' DB=postgresql
+ - RAILS_VERSION='~>3.2.0'
+ - RAILS_VERSION='~>3.2.0' DB=mysql
+ - RAILS_VERSION='~>3.2.0' DB=postgresql
+ - RAILS_VERSION=3-1-stable
+ - RAILS_VERSION=3-1-stable DB=mysql
+ - RAILS_VERSION=3-1-stable DB=postgresql
+ - RAILS_VERSION=3-2-stable
+ - RAILS_VERSION=3-2-stable DB=mysql
+ - RAILS_VERSION=3-2-stable DB=postgresql
+ - RAILS_VERSION=master
+ - RAILS_VERSION=master DB=mysql
+ - RAILS_VERSION=master DB=postgresql
+
+matrix:
+ exclude:
+ - rvm: 1.9.2
+ env: RAILS_VERSION=master
+ - rvm: 1.9.2
+ env: RAILS_VERSION=master DB=mysql
+ - rvm: 1.9.2
+ env: RAILS_VERSION=master DB=postgresql
View
11 Gemfile
@@ -2,3 +2,14 @@ source "http://rubygems.org"
# Specify your gem's dependencies in activeuuid.gemspec
gemspec
+
+case version = ENV['ACTIVERECORD_VERSION'] || '~> 3.2'
+when /master/
+ gem "activerecord", :github => "rails/rails"
+when /3-1-stable/
+ gem "activerecord", :github => "rails/rails", :branch => "3-1-stable"
+when /3-2-stable/
+ gem "activerecord", :github => "rails/rails", :branch => "3-2-stable"
+else
+ gem "activerecord", version
+end
View
2  lib/activeuuid/patches.rb
@@ -52,7 +52,7 @@ def type_cast_with_visiting(value, column = nil)
def self.apply!
ActiveRecord::ConnectionAdapters::Table.send :include, Migrations if defined? ActiveRecord::ConnectionAdapters::Table
ActiveRecord::ConnectionAdapters::TableDefinition.send :include, Migrations if defined? ActiveRecord::ConnectionAdapters::TableDefinition
- ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter.send :include, Quoting if defined? ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter
+ ActiveRecord::ConnectionAdapters::Mysql2Adapter.send :include, Quoting if defined? ActiveRecord::ConnectionAdapters::Mysql2Adapter
ActiveRecord::ConnectionAdapters::SQLite3Adapter.send :include, Quoting if defined? ActiveRecord::ConnectionAdapters::SQLite3Adapter
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.send :include, PostgreSQLQuoting if defined? ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
end
View
7 lib/activeuuid/uuid.rb
@@ -1,8 +1,8 @@
require 'uuidtools'
+# monkey-patch Friendly::UUID to serialize UUIDs
module UUIDTools
class UUID
- # monkey-patch Friendly::UUID to serialize UUIDs to MySQL
alias_method :id, :raw
def quoted_id
@@ -17,6 +17,9 @@ def as_json(options = nil)
def to_param
hexdigest.upcase
end
+
+ # duck typing activerecord 3.1 dirty hack )
+ def gsub *; self; end
end
end
@@ -75,7 +78,7 @@ def dump(uuid)
private
def parse_string str
- return nil if str.blank?
+ return nil if str.length == 0
if str.length == 36
UUIDTools::UUID.parse str
elsif str.length == 32
View
7 spec/support/database.yml
@@ -4,12 +4,9 @@ sqlite3:
postgresql:
adapter: postgresql
username: postgres
- password:
database: activeuuid_test
- min_messages: ERROR
mysql:
adapter: mysql2
- host: localhost
username: root
- password:
- database: activeuuid_test
+ database: activeuuid_test
+ encoding: utf8
Something went wrong with that request. Please try again.