Permalink
Browse files

Merge branch 'master' of github.com:cmer/socialization

Conflicts:
	.gitignore
  • Loading branch information...
2 parents 7db65f5 + 2b26170 commit 279a3cc9a23ae38003f2c6f677d19d891d3bc235 @cmer committed Jun 1, 2012
View
3 .gitignore
@@ -9,4 +9,5 @@ Gemfile.lock
log
doc
.yardoc
-.rbenv-version
+.rbenv-version
+gemfiles
View
6 gemfiles/activerecord30.gemfile
@@ -1,6 +0,0 @@
-# This file was generated by Appraisal
-
-source "http://rubygems.org"
-
-gem "activerecord", "~> 3.0.10"
-
View
23 gemfiles/activerecord30.gemfile.lock
@@ -1,23 +0,0 @@
-GEM
- remote: http://rubygems.org/
- specs:
- activemodel (3.0.11)
- activesupport (= 3.0.11)
- builder (~> 2.1.2)
- i18n (~> 0.5.0)
- activerecord (3.0.11)
- activemodel (= 3.0.11)
- activesupport (= 3.0.11)
- arel (~> 2.0.10)
- tzinfo (~> 0.3.23)
- activesupport (3.0.11)
- arel (2.0.10)
- builder (2.1.2)
- i18n (0.5.0)
- tzinfo (0.3.31)
-
-PLATFORMS
- ruby
-
-DEPENDENCIES
- activerecord (~> 3.0.10)
View
6 gemfiles/activerecord31.gemfile
@@ -1,6 +0,0 @@
-# This file was generated by Appraisal
-
-source "http://rubygems.org"
-
-gem "activerecord", "~> 3.1.1"
-
View
25 gemfiles/activerecord31.gemfile.lock
@@ -1,25 +0,0 @@
-GEM
- remote: http://rubygems.org/
- specs:
- activemodel (3.1.3)
- activesupport (= 3.1.3)
- builder (~> 3.0.0)
- i18n (~> 0.6)
- activerecord (3.1.3)
- activemodel (= 3.1.3)
- activesupport (= 3.1.3)
- arel (~> 2.2.1)
- tzinfo (~> 0.3.29)
- activesupport (3.1.3)
- multi_json (~> 1.0)
- arel (2.2.2)
- builder (3.0.0)
- i18n (0.6.0)
- multi_json (1.1.0)
- tzinfo (0.3.31)
-
-PLATFORMS
- ruby
-
-DEPENDENCIES
- activerecord (~> 3.1.1)
View
6 gemfiles/activerecord32.gemfile
@@ -1,6 +0,0 @@
-# This file was generated by Appraisal
-
-source "http://rubygems.org"
-
-gem "activerecord", "~> 3.2.1"
-
View
25 gemfiles/activerecord32.gemfile.lock
@@ -1,25 +0,0 @@
-GEM
- remote: http://rubygems.org/
- specs:
- activemodel (3.2.1)
- activesupport (= 3.2.1)
- builder (~> 3.0.0)
- activerecord (3.2.1)
- activemodel (= 3.2.1)
- activesupport (= 3.2.1)
- arel (~> 3.0.0)
- tzinfo (~> 0.3.29)
- activesupport (3.2.1)
- i18n (~> 0.6)
- multi_json (~> 1.0)
- arel (3.0.1)
- builder (3.0.0)
- i18n (0.6.0)
- multi_json (1.1.0)
- tzinfo (0.3.31)
-
-PLATFORMS
- ruby
-
-DEPENDENCIES
- activerecord (~> 3.2.1)
View
5 lib/socialization/follower.rb
@@ -28,7 +28,10 @@ def is_follower?
def follow!(followable)
raise ArgumentError, "#{followable} is not followable!" unless followable.is_followable?
raise ArgumentError, "#{self} cannot follow itself!" unless self != followable
- Follow.create!({ :follower => self, :followable => followable }, :without_protection => true)
+ Follow.create! do |follow|
+ follow.follower = self
+ follow.followable = followable
+ end
end
# Delete a {FollowStore follow} relationship.
View
5 lib/socialization/liker.rb
@@ -28,7 +28,10 @@ def is_liker?
def like!(likeable)
ensure_likeable!(likeable)
raise ArgumentError, "#{self} cannot like itself!" unless self != likeable
- Like.create!({ :liker => self, :likeable => likeable }, :without_protection => true)
+ Like.create! do |like|
+ like.liker = self
+ like.likeable = likeable
+ end
end
# Delete a {LikeStore like} relationship.
View
5 lib/socialization/mentioner.rb
@@ -27,7 +27,10 @@ def is_mentioner?
# @return [MentionStore] the newly created {MentionStore mention} record.
def mention!(mentionable)
ensure_mentionable!(mentionable)
- Mention.create!({ :mentioner => self, :mentionable => mentionable }, :without_protection => true)
+ Mention.create! do |mention|
+ mention.mentioner = self
+ mention.mentionable = mentionable
+ end
end
# Delete a {MentionStore mention} relationship.
View
3 test/follow_test.rb
@@ -129,7 +129,8 @@ class FollowTest < Test::Unit::TestCase
context "acts_as_follow_store" do
should "touch associated record when touch_follower and/or touch_followable are set" do
class Foo < ActiveRecord::Base
- self.table_name = 'follows'; acts_as_follow_store :touch_follower => true, :touch_followable => true
+ self.table_name = 'follows'
+ acts_as_follow_store :touch_follower => true, :touch_followable => true
end
f = Foo.new
assert f.methods.map {|x| x.to_s}.include?('belongs_to_touch_after_save_or_destroy_for_followable')

0 comments on commit 279a3cc

Please sign in to comment.