Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

updates for rails 3.2.12 compatibility

  • Loading branch information...
commit 95688444984ab6c6392d9ab6f9189b23408f558b 1 parent edbc365
@mattherick mattherick authored
View
4 Gemfile
@@ -1,4 +1,2 @@
-
source :rubygems
-gemspec
-
+gemspec
View
49 Gemfile.lock
@@ -1,36 +1,39 @@
PATH
remote: .
specs:
- translate_columns (1.1.0)
- activerecord (~> 3.0.0)
+ translate_columns (1.1.1)
+ activerecord (~> 3.2.12)
GEM
remote: http://rubygems.org/
specs:
- activemodel (3.0.3)
- activesupport (= 3.0.3)
- builder (~> 2.1.2)
- i18n (~> 0.4)
- activerecord (3.0.3)
- activemodel (= 3.0.3)
- activesupport (= 3.0.3)
- arel (~> 2.0.2)
- tzinfo (~> 0.3.23)
- activesupport (3.0.3)
- arel (2.0.7)
- builder (2.1.2)
- i18n (0.5.0)
- mocha (0.9.10)
- rake
- rake (0.8.7)
- sqlite3 (1.3.3)
- tzinfo (0.3.24)
+ activemodel (3.2.12)
+ activesupport (= 3.2.12)
+ builder (~> 3.0.0)
+ activerecord (3.2.12)
+ activemodel (= 3.2.12)
+ activesupport (= 3.2.12)
+ arel (~> 3.0.2)
+ tzinfo (~> 0.3.29)
+ activesupport (3.2.12)
+ i18n (~> 0.6)
+ multi_json (~> 1.0)
+ arel (3.0.2)
+ builder (3.0.4)
+ i18n (0.6.4)
+ metaclass (0.0.1)
+ mocha (0.13.3)
+ metaclass (~> 0.0.1)
+ multi_json (1.6.1)
+ rake (10.0.3)
+ sqlite3 (1.3.7)
+ tzinfo (0.3.37)
PLATFORMS
ruby
DEPENDENCIES
- activerecord (~> 3.0.0)
- mocha (~> 0.9.3)
- sqlite3 (~> 1.3.3)
+ mocha (~> 0.13.3)
+ rake (~> 10.0.3)
+ sqlite3 (~> 1.3.7)
translate_columns!
View
4 Rakefile
@@ -1,6 +1,6 @@
require 'rake'
require 'rake/testtask'
-require 'rake/rdoctask'
+require 'rdoc/task'
desc 'Default: run unit tests.'
task :default => :test
@@ -20,4 +20,4 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.options << '--line-numbers' << '--inline-source'
rdoc.rdoc_files.include('README')
rdoc.rdoc_files.include('lib/**/*.rb')
-end
+end
View
2  VERSION
@@ -1 +1 @@
-1.1.1
+1.1.1
View
4 init.rb
@@ -1,3 +1 @@
-
-require 'translate_columns'
-
+require 'translate_columns'
View
2  install.rb
@@ -1 +1 @@
-# Install hook code here
+# Install hook code here
View
4 lib/translate_columns.rb
@@ -167,7 +167,7 @@ def translation
if !@translation || (@translation.locale != translation_locale)
raise MissingParent, "Cannot create translations without a stored parent" if new_record?
# try to find translation or build a new one
- @translation = translations.find_by_locale(translation_locale) || translations.build(:locale => translation_locale)
+ @translation = translations.where(:locale => translation_locale).first || translations.build(:locale => translation_locale)
end
@translation
else
@@ -225,4 +225,4 @@ def attributes_with_locale=(new_attributes, guard_protected_attributes = true)
end
end
-end
+end
View
7 test/fixtures/document.rb
@@ -4,8 +4,7 @@ class Document < ActiveRecord::Base
has_many :translations, :class_name => 'DocumentTranslation'
translate_columns :title, :body
- validates_presence_of :title
- validates_length_of :title, :within => 3..200
+ validates :title, :presence => true, :length => { :in => 3..200 }
+ validates :body, :length => { :in => 3..500 }
- validates_length_of :body, :within => 3..500
-end
+end
View
2  test/fixtures/document_translation.rb
@@ -1,3 +1,3 @@
class DocumentTranslation < ActiveRecord::Base
-end
+end
View
3  test/fixtures/document_translations.yml
@@ -10,5 +10,4 @@ translation2:
document_id: 1
locale: fr
title: Un title en francais
- body:
-
+ body:
View
3  test/fixtures/documents.yml
@@ -9,5 +9,4 @@ document2:
title: Test Document Number 2
locale: en
body: This is a second test document with some random content for the body.
- published_at: "2009-09-23 21:53:46"
-
+ published_at: "2009-09-23 21:53:46"
View
3  test/fixtures/schema.rb
@@ -14,5 +14,4 @@
t.column "body", :text
t.timestamps
end
-end
-
+end
View
3  test/lib/activerecord_connector.rb
@@ -2,5 +2,4 @@
require 'active_record/fixtures'
conf = YAML::load(File.open(File.dirname(__FILE__) + '/../database.yml'))
-ActiveRecord::Base.establish_connection(conf['sqlite3'])
-
+ActiveRecord::Base.establish_connection(conf['sqlite3'])
View
4 test/lib/activerecord_test_helper.rb
@@ -1,4 +1,3 @@
-
require 'activerecord_connector'
require File.join(File.dirname(__FILE__), '../fixtures/schema.rb')
@@ -6,5 +5,4 @@ module ActiverecordTestHelper
FIXTURES_PATH = File.join(File.dirname(__FILE__), '/../fixtures')
dep = defined?(ActiveSupport::Dependencies) ? ActiveSupport::Dependencies : ::Dependencies
dep.autoload_paths.unshift FIXTURES_PATH
-end
-
+end
View
8 test/translate_columns_test.rb
@@ -2,7 +2,7 @@
require 'bundler/setup'
require 'test/unit'
-require 'mocha'
+require "mocha/setup"
require 'activerecord_test_helper'
require 'translate_columns'
@@ -12,11 +12,11 @@ class TranslateColumnsTest < Test::Unit::TestCase
include ActiverecordTestHelper
def setup
- @docs = Fixtures.create_fixtures(FIXTURES_PATH, ['documents', 'document_translations'])
+ @docs = ActiveRecord::Fixtures.create_fixtures(FIXTURES_PATH, ['documents', 'document_translations'])
end
def teardown
- Fixtures.reset_cache
+ ActiveRecord::Fixtures.reset_cache
end
def test_basic_document_fields
@@ -150,4 +150,4 @@ def test_create_new_document_with_specific_locale
assert doc.save
end
-end
+end
View
10 translate_columns.gemspec
@@ -21,8 +21,8 @@ Gem::Specification.new do |s|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.require_paths = ["lib"]
- s.add_dependency("activerecord", "~> 3.0.0")
- s.add_development_dependency(%q<mocha>, "~> 0.9.3")
- s.add_development_dependency(%q<sqlite3>, "~> 1.3.3")
-end
-
+ s.add_dependency("activerecord", "~> 3.2.12")
+ s.add_development_dependency("rake", "~> 10.0.3")
+ s.add_development_dependency("mocha", "~> 0.13.3")
+ s.add_development_dependency("sqlite3", "~> 1.3.7")
+end
Please sign in to comment.
Something went wrong with that request. Please try again.