one_touch 1.1.2 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -87,8 +87,8 @@ module OneTouch
87
87
  def generate_del_methods(name)
88
88
  method_name = "del_#{name}".to_sym
89
89
  define_singleton_method method_name do |ope,res,other_field_option={}|
90
- query_hash = other_field_option.merge(context: name, favorable: res)
91
- favor = ope.favors.where(query_hash)
90
+ query_hash = other_field_option.merge(context: name)
91
+ favor = ope.favors.where(query_hash).favorable_as(res)
92
92
  if favor.present?
93
93
  favor.first.destroy
94
94
  else
@@ -1,3 +1,3 @@
1
1
  module OneTouch
2
- VERSION = "1.1.2"
2
+ VERSION = "1.2.0"
3
3
  end
data/readme.md CHANGED
@@ -3,6 +3,8 @@ In webapp, many data is generated by just one click like focus someone, dislike
3
3
 
4
4
  These one click data most are relation data and was managed in single model in this gem. So we can analyze the relation data easily.
5
5
 
6
+ Version ~> 1.1.0 has a serious bug. Please update to ~> 1.2.0
7
+
6
8
  ## Dependency
7
9
  Rails > 3.0.
8
10
  Conflict with gem meta_where and squeel. Cause it changes some AR query syntax.
@@ -38,6 +38,11 @@ describe OneTouch::ActsAsFavor do
38
38
  end
39
39
  end
40
40
 
41
+ it "should remove focus to tag" do
42
+ Favor.del_favorite(foo, tag)
43
+ Favor.where(:context => :favorite).host_as(foo).favorable_as(tag).should eq([])
44
+ end
45
+
41
46
  it "should add a focus to a tag " do
42
47
  fly_favor = Favor.add_focus foo,fly_tag
43
48
  fly_favor.should be_true
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: one_touch
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-11-21 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &16063180 !ruby/object:Gem::Requirement
16
+ requirement: &12802700 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '3.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *16063180
24
+ version_requirements: *12802700
25
25
  description: ! ' Make one click operation simple '
26
26
  email:
27
27
  - raykincoldxiao@gmail.com