seoable 0.2.0 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/concerns/seoable/acts_as_seoable.rb +14 -3
- data/lib/seoable/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e607ebfc897971a2a6cdb5c857adf653b330637e
|
4
|
+
data.tar.gz: 16c3caf62136379e8b30c2f719edd276b708d2ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a05c38c6040b3537f180d6355331ec0f63432050dc192e7bc5bdd2d1fbfbd511209ee3286d13eefd7432087f17ea304a78cc266d3979a0015806e0ec2e685be3
|
7
|
+
data.tar.gz: 89fc044b406cb400a875512425bd43c054988f135895cd449103d7bcc14e586e4782e02d4fc5b88711567fb88ef405ee94bc4f7cbecd5879837e4fd833413515
|
@@ -8,9 +8,6 @@ module Seoable
|
|
8
8
|
extend FriendlyId
|
9
9
|
friendly_id :slug, use: :finders
|
10
10
|
|
11
|
-
default_scope { joins_seo_detail }
|
12
|
-
scope :joins_seo_detail, -> { includes(:seo_detail) }
|
13
|
-
|
14
11
|
delegate :meta_title, to: :seo_detail, allow_nil: true
|
15
12
|
delegate :meta_title=, to: :seo_detail, allow_nil: true
|
16
13
|
delegate :meta_description, to: :seo_detail, allow_nil: true
|
@@ -18,6 +15,20 @@ module Seoable
|
|
18
15
|
delegate :slug, to: :seo_detail, allow_nil: true
|
19
16
|
delegate :slug=, to: :seo_detail, allow_nil: true
|
20
17
|
|
18
|
+
default_scope { joins_seo_detail }
|
19
|
+
scope :joins_seo_detail, -> do
|
20
|
+
table_name = self.table_name
|
21
|
+
seoable_type = self.name
|
22
|
+
|
23
|
+
joins(
|
24
|
+
'INNER JOIN "seo_details" ON ' +
|
25
|
+
'"seo_details"."seoable_id" = ' +
|
26
|
+
"\"#{table_name}\".\"id\"" + ' AND ' +
|
27
|
+
'"seo_details"."seoable_type" =' +
|
28
|
+
"'#{seoable_type}'"
|
29
|
+
)
|
30
|
+
end
|
31
|
+
|
21
32
|
after_save do
|
22
33
|
seo_detail.save
|
23
34
|
end
|
data/lib/seoable/version.rb
CHANGED