cas-cms 0.1.2 → 0.1.3

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: 65ed8104b0e4bbbe13af82ee43302a442326ab8e
4
- data.tar.gz: 5549c620ce2a91860004f17cf9b39dc91caba165
3
+ metadata.gz: e4cf4081ecbfe1307e6d39d6b64156b98a494f3b
4
+ data.tar.gz: b1b59204366430b4ff05abf74dd64107524373d5
5
5
  SHA512:
6
- metadata.gz: 853582bf4b21e1ffff020f05baded5d8587622b046d0c9d2c8246c453c4aa729be91c743a4629799f8997433f895fdcad59ebee0550bd7ea2cdde1efbb611b06
7
- data.tar.gz: 11e90ca7594186a7718087cd54d5496c5c667239f10660b844161501636455bb0dac953a63e2b011cab5ed3d6b072d12015a5bd797d302015cb892be80a0768a
6
+ metadata.gz: 4144df8905ec86fd3102dcf0cfc7cef2053b314f40a749059a305e97b552187144fc8f669e13e90de69649092522a6edf3c9fc8f40bc23f9637be297d8d436da
7
+ data.tar.gz: d66d1a0ea481f0e9562e0f370a8dda0fbadcd23787fcbe260a9bfeb9ee3c3e9a8314ae7553312b2854258ffe17343037c24f89a31b5c579a7fe72836217e3336
@@ -9,6 +9,7 @@ module Cas
9
9
  serialize :metadata
10
10
 
11
11
  belongs_to :section
12
+ has_one :site, through: :section
12
13
  belongs_to :category
13
14
  belongs_to :author, class_name: Cas::User
14
15
  has_many :images, ->{ where(media_type: :image).order("cas_media_files.order ASC") }, class_name: Cas::MediaFile, as: :attachable, dependent: :destroy
@@ -15,6 +15,10 @@ module Cas
15
15
  scope :non_cover, ->{ where(cover: false) }
16
16
  scope :usable, -> { where.not(attachable_id: nil) }
17
17
 
18
+ def site
19
+ attachable.site || raise("Attachable doesn't have a Cas::Site association")
20
+ end
21
+
18
22
  def url(version:, use_cdn: true)
19
23
  cdn = ENV.fetch("CDN_HOST", nil) if use_cdn
20
24
 
@@ -1,3 +1,3 @@
1
1
  module Cas
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cas-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexandre de Oliveira
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-23 00:00:00.000000000 Z
11
+ date: 2018-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails