polygallery 0.0.6 → 0.0.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: fa8cf686b91461b641c623f287b714d88228c213
4
- data.tar.gz: e14a13e661db654aa21cc12265f7983ccdd53d4a
3
+ metadata.gz: 40b6058f68d72353fc34e17997936f3b1096063f
4
+ data.tar.gz: df9ed80c23c5ef9ef3bde7a272485e91c4390ca8
5
5
  SHA512:
6
- metadata.gz: 5af1d4642df622bd9901edfaa9b22ea5c24d334ee2f6e416954d9c4cdd7de7af580a3a713e199e620d6fb3cd7a389a91edfb7c3b6b396d2dd21eb60075bb61f6
7
- data.tar.gz: 7d4e6bca81fad31a6da6a7e7a0a8a5624611893fe67d392bc1b4dfe87cc43703e95962197778ce87a4192880c0e6ad50046039d87d2e929e2952cb6f983abe16
6
+ metadata.gz: 1cfb242774808827303b01187ab2daab6cc620f3d3b20ff5482a22729a2486f60412ef60a1a45d85212724791e58d533ab35ec833c8bb3dfcebe0f5538a7b735
7
+ data.tar.gz: 659c46c8f5bd5e817da3c11439b15afbf4e9a251670e0ecb7ae0529309ef3ed5c8b79e98d4cb820912a2309f30c41d280cda77a3002f7b08c971e00878d5b950
@@ -21,7 +21,22 @@ module Polygallery
21
21
  has_polyphotos
22
22
 
23
23
  def settings
24
- self.galleryable.send("#{title}_settings".to_sym)
24
+ if galleryable.present?
25
+ galleryable.send("#{title}_settings".to_sym)
26
+ elsif galleryable_id.present? && galleryable_type.present?
27
+ puts 'Galleryable can\'t be loaded'
28
+ klass = Object.const_get(galleryable_type)
29
+ if klass.exists? :id => galleryable_id
30
+ puts 'Galleryable found! Attempting to load now.'
31
+ klass.find(galleryable_id).send("#{title}_settings".to_sym)
32
+ else
33
+ puts 'Galleryable still not found.'
34
+ DEFAULTS
35
+ end
36
+ else
37
+ puts 'WARNING: Galleryable not found! Using default paperclip settings...'
38
+ DEFAULTS
39
+ end
25
40
  end
26
41
 
27
42
  end
@@ -8,6 +8,10 @@ module Polygallery
8
8
 
9
9
  module ClassMethods
10
10
  def has_polygallery(title='gallery', options={})
11
+ if title.is_a? Hash
12
+ options = title
13
+ title = 'gallery'
14
+ end
11
15
  defaults = Gallery::DEFAULTS
12
16
  settings = defaults.deep_merge(options)
13
17
  has_one title.to_sym, -> { where(:title => title.to_s) }, settings[:association]
@@ -1,3 +1,3 @@
1
1
  module Polygallery
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -2,7 +2,6 @@ class HomeController < ApplicationController
2
2
 
3
3
  def index
4
4
  @event = Event.new
5
- raise 'BOOM'
6
5
  end
7
6
 
8
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: polygallery
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - MacKinley Smith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-26 00:00:00.000000000 Z
11
+ date: 2014-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails