Skip to content

Commit

Permalink
Update dragonfly
Browse files Browse the repository at this point in the history
  • Loading branch information
mshibuya committed Feb 5, 2014
1 parent 4d5fa97 commit ba5e20f
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Expand Up @@ -50,7 +50,7 @@ group :test do
gem 'coveralls', require: false
gem 'database_cleaner', '>= 1.2'
gem 'devise', '>= 3.2'
gem 'dragonfly', '~> 0.9.0'
gem 'dragonfly', '~> 1.0'
gem 'factory_girl', '>= 4.2'
gem 'generator_spec', '>= 0.8'
gem 'launchy', '>= 2.2'
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy_app/Gemfile
Expand Up @@ -39,7 +39,7 @@ end

gem 'carrierwave', '>= 0.8'
gem 'devise', '>= 3.2'
gem 'dragonfly', '~> 0.9.0'
gem 'dragonfly', '~> 1.0'
gem 'mini_magick', '>= 3.4'
gem 'mlb', '>= 0.7'
gem 'paperclip', '3.5.2'
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy_app/app/active_record/field_test.rb
Expand Up @@ -9,6 +9,6 @@ class FieldTest < ActiveRecord::Base
attr_accessor :delete_paperclip_asset
before_validation { self.paperclip_asset = nil if delete_paperclip_asset == '1' }

image_accessor :dragonfly_asset
dragonfly_accessor :dragonfly_asset
mount_uploader :carrierwave_asset, CarrierwaveUploader
end
3 changes: 2 additions & 1 deletion spec/dummy_app/app/mongoid/field_test.rb
Expand Up @@ -2,6 +2,7 @@ class FieldTest
include Mongoid::Document
include Mongoid::Paperclip
include ActiveModel::ForbiddenAttributesProtection
extend Dragonfly::Model

field :name, type: String
field :title, type: String
Expand Down Expand Up @@ -47,7 +48,7 @@ class FieldTest

field :dragonfly_asset_name
field :dragonfly_asset_uid
image_accessor :dragonfly_asset
dragonfly_accessor :dragonfly_asset
mount_uploader :carrierwave_asset, CarrierwaveUploader

validates :short_text, length: {maximum: 255}
Expand Down
30 changes: 23 additions & 7 deletions spec/dummy_app/config/initializers/dragonfly.rb
@@ -1,11 +1,27 @@
if defined?(Mongoid::Document)
require 'dragonfly'
require 'dragonfly'

app = Dragonfly[:images]
# Configure
Dragonfly.app.configure do
plugin :imagemagick

# Configure to use ImageMagick, Rails defaults
app.configure_with(:imagemagick)
protect_from_dos_attacks true
secret "904547b2be647f0e11a76933b3220d6bd2fb83f380ac760125e4daa3b9504b4e"

# Allow all mongoid models to use the macro 'image_accessor'
app.define_macro_on_include(Mongoid::Document, :image_accessor)
url_format "/media/:job/:name"

datastore :file,
root_path: Rails.root.join('public/system/dragonfly', Rails.env),
server_root: Rails.root.join('public')
end

# Logger
Dragonfly.logger = Rails.logger

# Mount as middleware
Rails.application.middleware.use Dragonfly::Middleware

# Add model functionality
if defined?(ActiveRecord::Base)
ActiveRecord::Base.extend Dragonfly::Model
ActiveRecord::Base.extend Dragonfly::Model::Validations
end
2 changes: 0 additions & 2 deletions spec/dummy_app/config/initializers/rails_admin.rb
@@ -1,5 +1,3 @@
require 'dragonfly/rails/images'

RailsAdmin.config do |c|
c.model Team do
include_all_fields
Expand Down

0 comments on commit ba5e20f

Please sign in to comment.