active_content 0.1.6 → 0.1.7

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: 306cd17dcc26dec11f03cbb2962af633f19495a3
4
- data.tar.gz: c3611f17322d2f19b4770f67452829af64ce03e9
3
+ metadata.gz: 8ea1d71cf07f41372716f69a3188f3c27b132f61
4
+ data.tar.gz: 771a12d7d2780d9f055119e5e1105bf17a92ab4b
5
5
  SHA512:
6
- metadata.gz: dfce19e1777822256f60937738961432a9f6a142bfeaf1eb1d36bd98124359c660d2e66a4f834d8412f0fa8c60378d4e46c1f613b3006a8c28d689386fa913ae
7
- data.tar.gz: ed7ec9961658fc85c4dea16d28061785e37ce91d0bfe2fb3f78fe1794e8d5e06860f93dd0896255953cc793a2c0887ddfeb9afac6715e724c23d67292a4d497f
6
+ metadata.gz: 5fa1d9ecab98318479e0c14d3413eb26613739ff268cf1289934a3de05a042d4db62d85d5ac04b1413ae1e2dbaabe9b80a8f69dea57bbe8b8427e50c35c9adef
7
+ data.tar.gz: ef0ed67a470e62a34780e0b4f801bc47819bbb2674812559697a34f80fd56877c8090c419303d821829f74659cd1d29ce7fa08baa05ce81abc88be3f4aaa8015
@@ -12,10 +12,6 @@ module ActiveContent
12
12
 
13
13
  has_one :"#{field}_metum", assoc_proc, assoc_opts
14
14
  delegate_attribute :value, cast_type, value_opts
15
-
16
- before_save do
17
- send(:"#{field}_metum=", nil) if send(field).blank?
18
- end
19
15
  end
20
16
  end
21
17
  end
@@ -3,18 +3,18 @@ module ActiveContent
3
3
  extend ActiveSupport::Concern
4
4
 
5
5
  class_methods do
6
- def has_templates(*templates)
6
+ def has_templates(*args)
7
7
  extend Enumerize
8
8
  include ActiveDelegate
9
9
 
10
- enumerize :template, in: templates, predicates: { prefix: true }
10
+ options = args.extract_options!
11
+ templates = args
12
+ default = options.fetch :default, templates.first
13
+
14
+ enumerize :template, in: templates, predicates: { prefix: true }, default: default
11
15
 
12
16
  has_one :view_template, as: :templatable, class_name: 'ActiveContent::Template', autosave: true, dependent: :destroy
13
17
  delegate_attribute :name, :string, to: :view_template, prefix: 'template', alias: :template, finder: true, scope: true
14
-
15
- before_save do
16
- self.view_template = nil if template.blank?
17
- end
18
18
  end
19
19
  end
20
20
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveContent
2
- VERSION = '0.1.6'
2
+ VERSION = '0.1.7'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_content
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Olibia Tsati
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2017-12-12 00:00:00.000000000 Z
12
+ date: 2017-12-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord