one_touch 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -60,11 +60,13 @@ module OneTouch
|
|
60
60
|
scope :host_as, lambda { |ahost| where(:host_id => ahost.id) }
|
61
61
|
else
|
62
62
|
scope :host_as, lambda { |ahost| where(:host_id => ahost.id, :host_type => ahost.class.name)}
|
63
|
+
scope :join_host, lambda { |type| joins("JOIN #{type.table_name} ON #{type.table_name}.id = #{table_name}.host_id AND #{table_name}.host_type = '#{type.to_s}'") }
|
63
64
|
end
|
64
65
|
if self.favorable_relation_type == :single
|
65
66
|
scope :favorable_as, lambda { |target| where(:favorable_id => target.id) }
|
66
67
|
else
|
67
68
|
scope :favorable_as, lambda { |target| where(:favorable_id => target.id, :favorable_type => target.class.name) }
|
69
|
+
scope :join_favorable, lambda { |type| joins("JOIN #{type.table_name} ON #{type.table_name}.id = #{table_name}.favorable_id AND #{table_name}.favorable_type = '#{type.to_s}'") }
|
68
70
|
end
|
69
71
|
|
70
72
|
if opt[:include_host_relation_module]
|
@@ -18,7 +18,7 @@ module OneTouch
|
|
18
18
|
module ClassMethods
|
19
19
|
|
20
20
|
def favor_to(favorable,context=default_context_in_host)
|
21
|
-
host_context_as(context)
|
21
|
+
host_context_as(context).merge(Favor.favorable_as favorable)
|
22
22
|
end
|
23
23
|
|
24
24
|
def after_load_acts_as_favor
|
data/lib/one_touch/version.rb
CHANGED
data/readme.md
CHANGED
@@ -4,7 +4,8 @@ In webapp, many data is generated by just one click like focus someone, dislike
|
|
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
6
|
## Dependency
|
7
|
-
Rails > 3.0
|
7
|
+
Rails > 3.0.
|
8
|
+
Conflict with gem meta_where and squeel. Cause it changes some AR query syntax.
|
8
9
|
|
9
10
|
## Usage
|
10
11
|
gem install one_touch
|
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.
|
4
|
+
version: 1.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-11-
|
12
|
+
date: 2011-11-21 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &16063180 !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: *
|
24
|
+
version_requirements: *16063180
|
25
25
|
description: ! ' Make one click operation simple '
|
26
26
|
email:
|
27
27
|
- raykincoldxiao@gmail.com
|