seoable 0.1.6 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0577d6ed10e221b6cc4f7b5d9ffefbc47d610b93
4
- data.tar.gz: 10595cecad4276633a6ebded8e78abe493a3f937
3
+ metadata.gz: 9b96eeef8619519dc135b4895bd15f0554ae6564
4
+ data.tar.gz: 0423dfe2a7429b258b13801bbbe977239a5b2f8a
5
5
  SHA512:
6
- metadata.gz: ed0f7c01da7fb91ddbdcdc423ef223b1dcc67b9c5c16be4278883402fcf247743f6f9619c83c22c80ba326334d8bd685f4b241a20bc82416ffe2910e257aba37
7
- data.tar.gz: 93db9f50947c61bef94d9437c2a7eecf4ed1910ec7e4fca76f1b9b15af9ff4356a4873a944a4557790b6255bb801a3e4ddaebdc63090622c879cf5604222eab2
6
+ metadata.gz: 2942f5b640bb9f31b7f46738b61dcf152bb7ba8178aa0ac37acff85a20e7e106237381db82b5f3324a0969f99c815f3e2bf75592cca29dcdcac1fcbfacdaf8b6
7
+ data.tar.gz: 4e0df858928f0f78a387cb760fe6cb43124bfddbafbf94dc28b5f13b5c014f1b84ec3d615142319be4f7c9f23782fb55b7fa0f03e83ccc261dc63759dd3edf20
@@ -11,20 +11,30 @@ module Seoable
11
11
  default_scope { joins_seo_detail }
12
12
  scope :joins_seo_detail, -> { includes(:seo_detail) }
13
13
 
14
- has_one :seo_detail,
15
- as: :seoable,
16
- dependent: :destroy,
17
- class_name: SeoDetail
18
-
19
- accepts_nested_attributes_for :seo_detail, reject_if: :all_blank
20
-
21
14
  delegate :meta_title, to: :seo_detail, allow_nil: true
15
+ delegate :meta_title=, to: :seo_detail, allow_nil: true
22
16
  delegate :meta_description, to: :seo_detail, allow_nil: true
17
+ delegate :meta_description=, to: :seo_detail, allow_nil: true
23
18
  delegate :slug, to: :seo_detail, allow_nil: true
19
+ delegate :slug=, to: :seo_detail, allow_nil: true
20
+
21
+ after_save do
22
+ seo_detail.save
23
+ end
24
+
25
+ after_destroy do
26
+ seo_detail.destroy
27
+ end
28
+
29
+ validate do
30
+ if seo_detail.invalid?
31
+ errors.add(:seo_detail, :invalid)
32
+ end
33
+ end
24
34
  end
25
35
 
26
36
  def seo_detail
27
- super || build_seo_detail(seo_detail_attributes)
37
+ @seo_detail ||= SeoDetail.where(seoable: self).first_or_initialize(seo_detail_attributes)
28
38
  end
29
39
 
30
40
  def seo_detail_attributes
@@ -1,3 +1,3 @@
1
1
  module Seoable
2
- VERSION = '0.1.6'
2
+ VERSION = '0.2.0'
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.1.6
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Viktor Fonic
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2015-11-23 00:00:00.000000000 Z
12
+ date: 2016-01-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: friendly_id
@@ -250,4 +250,3 @@ signing_key:
250
250
  specification_version: 4
251
251
  summary: Make your webapp Search Engine friendly
252
252
  test_files: []
253
- has_rdoc: