Skip to content

Commit

Permalink
fix has one assciation issue
Browse files Browse the repository at this point in the history
  • Loading branch information
hooopo committed Aug 11, 2012
1 parent bd474b3 commit 71c5c58
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@
1.3.1
-----
* [clean cache after update_column/increment!/decrement!]

1.3.2
-----
* [fix has one assciation issue]
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
second_level_cache (1.2.1)
second_level_cache (1.3.2)
activesupport (~> 3.2.0)

GEM
Expand Down
4 changes: 2 additions & 2 deletions lib/second_level_cache/active_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
require 'second_level_cache/active_record/base'
require 'second_level_cache/active_record/finder_methods'
require 'second_level_cache/active_record/persistence'
require 'second_level_cache/active_record/singular_association'
require 'second_level_cache/active_record/belongs_to_association'

ActiveRecord::Base.send(:include, SecondLevelCache::Mixin)
ActiveRecord::Base.send(:include, SecondLevelCache::ActiveRecord::Base)
ActiveRecord::FinderMethods.send(:include, SecondLevelCache::ActiveRecord::FinderMethods)
ActiveRecord::Base.send(:include, SecondLevelCache::ActiveRecord::Persistence)
ActiveRecord::Associations::SingularAssociation.send(:include, SecondLevelCache::ActiveRecord::Associations::SingularAssociation)
ActiveRecord::Associations::BelongsToAssociation.send(:include, SecondLevelCache::ActiveRecord::Associations::BelongsToAssociation)
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
module SecondLevelCache
module ActiveRecord
module Associations
module SingularAssociation
module BelongsToAssociation
extend ActiveSupport::Concern
included do
class_eval do
Expand Down
2 changes: 1 addition & 1 deletion lib/second_level_cache/version.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- encoding : utf-8 -*-
module SecondLevelCache
VERSION = "1.3.1"
VERSION = "1.3.2"
end
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# -*- encoding : utf-8 -*-
require 'active_record/test_helper'

class ActiveRecord::SingularAssociationTest < Test::Unit::TestCase
class ActiveRecord::BelongsToAssociationTest < Test::Unit::TestCase
def setup
@user = User.create :name => 'csdn', :email => 'test@csdn.com'
end

def test_should_get_cache_when_use_singular_association
def test_should_get_cache_when_use_belongs_to_association
book = @user.books.create

no_connection do
assert_equal @user, book.user
end
end

def test_should_write_singular_association_cache
def test_should_write_belongs_to_association_cache
book = @user.books.create
@user.expire_second_level_cache
assert_nil User.read_second_level_cache(@user.id)
Expand Down

0 comments on commit 71c5c58

Please sign in to comment.