seoable 0.2.0 → 0.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9b96eeef8619519dc135b4895bd15f0554ae6564
4
- data.tar.gz: 0423dfe2a7429b258b13801bbbe977239a5b2f8a
3
+ metadata.gz: e607ebfc897971a2a6cdb5c857adf653b330637e
4
+ data.tar.gz: 16c3caf62136379e8b30c2f719edd276b708d2ff
5
5
  SHA512:
6
- metadata.gz: 2942f5b640bb9f31b7f46738b61dcf152bb7ba8178aa0ac37acff85a20e7e106237381db82b5f3324a0969f99c815f3e2bf75592cca29dcdcac1fcbfacdaf8b6
7
- data.tar.gz: 4e0df858928f0f78a387cb760fe6cb43124bfddbafbf94dc28b5f13b5c014f1b84ec3d615142319be4f7c9f23782fb55b7fa0f03e83ccc261dc63759dd3edf20
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
@@ -1,3 +1,3 @@
1
1
  module Seoable
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seoable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Viktor Fonic