seo_meta 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/seo_meta.rb +1 -1
- data/lib/seo_meta/instance_methods.rb +9 -5
- metadata +3 -2
data/lib/seo_meta.rb
CHANGED
@@ -35,7 +35,7 @@ def is_seo_meta(options = {})
|
|
35
35
|
extend ::SeoMeta::ClassMethods
|
36
36
|
|
37
37
|
# Ensure seo_meta is saved when the model is saved.
|
38
|
-
after_save :save_meta_tags
|
38
|
+
after_save :save_meta_tags!
|
39
39
|
|
40
40
|
# Delegate both the accessor and setters for the fields to :seo_meta
|
41
41
|
fields = ::SeoMeta.attributes.keys.reject{|field|
|
@@ -5,10 +5,9 @@ module SeoMeta
|
|
5
5
|
def included(base)
|
6
6
|
# This has to be introduced using module_eval because it overrides something.
|
7
7
|
base.module_eval do
|
8
|
-
def
|
9
|
-
|
8
|
+
def seo_meta
|
9
|
+
find_seo_meta_tags || build_seo_meta_tags
|
10
10
|
end
|
11
|
-
alias_method_chain :seo_meta, :build
|
12
11
|
|
13
12
|
def attributes
|
14
13
|
super.merge(seo_meta_attributes)
|
@@ -34,12 +33,17 @@ module SeoMeta
|
|
34
33
|
end
|
35
34
|
|
36
35
|
protected
|
36
|
+
def find_seo_meta_tags
|
37
|
+
@seo_meta ||= ::SeoMetum.where(:seo_meta_type => self.class.name,
|
38
|
+
:seo_meta_id => self.id).first
|
39
|
+
end
|
40
|
+
|
37
41
|
def build_seo_meta_tags
|
38
42
|
@seo_meta ||= ::SeoMetum.new :seo_meta_type => self.class.name
|
39
43
|
end
|
40
44
|
|
41
|
-
def save_meta_tags
|
42
|
-
seo_meta.seo_meta_id ||= self.id
|
45
|
+
def save_meta_tags!
|
46
|
+
seo_meta.seo_meta_id ||= self.id unless seo_meta.persisted?
|
43
47
|
seo_meta.save
|
44
48
|
end
|
45
49
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: seo_meta
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.0.
|
5
|
+
version: 1.0.5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Philip Arndt
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-04-
|
13
|
+
date: 2011-04-28 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: refinerycms-generators
|
@@ -70,3 +70,4 @@ specification_version: 3
|
|
70
70
|
summary: SEO Meta tags plugin
|
71
71
|
test_files: []
|
72
72
|
|
73
|
+
has_rdoc:
|