rails_kindeditor 0.3.5 → 0.3.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,6 @@
1
1
  class Kindeditor::Asset < ActiveRecord::Base
2
- set_table_name "kindeditor_assets"
2
+ set_table_name 'kindeditor_assets'
3
+ mount_uploader :asset, AssetUploader
3
4
  validates_presence_of :asset
4
5
  before_save :update_asset_attributes
5
6
  attr_accessible :asset
@@ -1,21 +1,22 @@
1
1
  require 'carrierwave/mongoid'
2
2
 
3
- class Kindeditor::Asset
4
- self.collection_name = 'kindeditor_assets'
3
+ class Kindeditor::Asset
5
4
  include Mongoid::Document
6
5
  include Mongoid::Timestamps
7
- mount_uploader :asset
6
+ mount_uploader :asset, AssetUploader
8
7
  field :file_size, :type => Integer
9
8
  field :file_type, :type => String
10
9
  validates_presence_of :asset
11
10
  before_save :update_asset_attributes
12
11
  attr_accessible :asset
12
+
13
+ def self.collection_name
14
+ :kindeditor_assets
15
+ end
13
16
 
14
17
  private
15
18
  def update_asset_attributes
16
- if asset.present? && asset_changed?
17
- self.content_type = asset.file.content_type
18
- self.file_size = asset.file.size
19
- end
19
+ self.file_size = asset.file.size
20
+ self.file_type = asset.file.content_type
20
21
  end
21
22
  end
@@ -1,4 +1,4 @@
1
1
  module RailsKindeditor
2
- VERSION = "0.3.5"
2
+ VERSION = "0.3.6"
3
3
  end
4
4
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_kindeditor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-06 00:00:00.000000000 Z
12
+ date: 2012-09-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: carrierwave