file_blobs_rails 0.2.2 → 0.2.3

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: 740e1bf80a4e98b59c77c3382b94a7c4b1ddb9f4
4
- data.tar.gz: d45516a3846ffe72956a847f6f176e91c26d1e5c
3
+ metadata.gz: 15fdd0105ee566c33758f396b859af4f546d5e0b
4
+ data.tar.gz: 3597044746807e70a8fcb268718af81d31bbed99
5
5
  SHA512:
6
- metadata.gz: 67a9a63c094a193b8a210c4a8a410063bf1e0e83650af47d7e320ecfefac5417e76c9aeb4964a3224cde3ebe48ce67b1769d2c0d648b15620a306a920a36f492
7
- data.tar.gz: 5b517bd14377121de9a7513a23855b68663b39e978c5d1622b30d257be02aff52d83b3f4e633eea868e0592be700638e35939e71ae77721f03683100d38bde0a
6
+ metadata.gz: ecbbd76abb5f324a86e896d21f0e4d855f95a936cdb8c5c0bde6515c9da03bd0b34f03d4de0c009949d48a95a38167dba445612f99a6f20dcf5e92e968eac63d
7
+ data.tar.gz: aa4dd6d632b13e560b4301036ae87eb7ebcf75cfdcd12941671ed9f50df6e4bcb325b9eda823f8d13a5e96e336aa5f45487c8aa47abba782ecb7f263c7a5ed4c
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.2
1
+ 0.2.3
@@ -2,11 +2,11 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: file_blobs_rails 0.2.2 ruby lib
5
+ # stub: file_blobs_rails 0.2.3 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "file_blobs_rails"
9
- s.version = "0.2.2"
9
+ s.version = "0.2.3"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
@@ -19,8 +19,9 @@ module BlobModel
19
19
  # The raw data in the file.
20
20
  validates :data, presence: true
21
21
  validates_each :data do |record, attr, value|
22
- if value && value.bytesize > 128.kilobytes
23
- record.errors.add attr, 'exceeds 128 kilobytes'.freeze
22
+ data_limit = record.class.column_for_attribute(:data).limit
23
+ if data_limit && value && value.bytesize > data_limit
24
+ record.errors.add attr, 'is too large'.freeze
24
25
  end
25
26
  end
26
27
  end
@@ -6,7 +6,7 @@ class ActiveRecordExtensionsTest < ActiveSupport::TestCase
6
6
  end
7
7
 
8
8
  test 'referenced blob validation' do
9
- @blob_owner.file.data = ' ' * 1.megabyte
9
+ @blob_owner.file_blob.id = nil
10
10
  assert !@blob_owner.valid?
11
11
  assert_not_empty @blob_owner.errors[:file_blob]
12
12
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: file_blobs_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Costan