banner_lite 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/banner_lite/banner.rb +3 -1
- data/lib/banner_lite/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 449315ee52bbcf5878370eb2aaa0522cc8d79a4f
|
4
|
+
data.tar.gz: aab0878687661b6fbea351b9435d0a3a6f15d6b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 926ab6a5c67d52afbd907d022bba131c5e978303b4816b2c8a4b5d617c0ad201ed5e965d47e6d70232a08363f3530734eac79ec153ce56953fbb9cea79bee723
|
7
|
+
data.tar.gz: adf7af78e687b62b25323252c1c56596ad803ab0b87b4f883e93976c272cf43d8933e7e2aac4ad2350db7214e749b60ca44567bbc301f6391c5dc480f38e626d
|
@@ -1,6 +1,8 @@
|
|
1
1
|
module BannerLite
|
2
2
|
class Banner < ActiveRecord::Base
|
3
3
|
attr_accessor :file
|
4
|
+
validates :url
|
5
|
+
validates :file, if: ->(b){ b.file_name.blank? }
|
4
6
|
|
5
7
|
before_save :fill_file_name, if: :file
|
6
8
|
after_save :save_file, if: :file
|
@@ -26,7 +28,7 @@ module BannerLite
|
|
26
28
|
end
|
27
29
|
|
28
30
|
def save_file
|
29
|
-
FileUtils.mkdir(base_dir)
|
31
|
+
FileUtils.mkdir(base_dir) unless File.directory?(base_dir)
|
30
32
|
File.open(base_dir + file_name, 'wb'){|f| f.write(file.read) }
|
31
33
|
end
|
32
34
|
end
|
data/lib/banner_lite/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: banner_lite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hiroki Yoshioka
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|