Skip to content

Instantly share code, notes, and snippets.

@ramontayag
Created October 28, 2010 02:53
Show Gist options
  • Save ramontayag/650518 to your computer and use it in GitHub Desktop.
Save ramontayag/650518 to your computer and use it in GitHub Desktop.
require 'dragonfly'
app = Dragonfly::App[:attachments]
if Rails.env == "production"
app.datastore = Dragonfly::DataStorage::S3DataStore.new
app.datastore.configure do |d|
d.bucket_name = 'xx'
d.access_key_id = 'xx'
d.secret_access_key = 'xax+x'
end
else
app.datastore = Dragonfly::DataStorage::FileDataStore.new
app.datastore.configure do |d|
d.root_path = "#{Rails.root}/public/dragonfly/#{Rails.env}"
end
end
app.configure_with(:rails) do |c|
c.register_analyser(Dragonfly::Analysis::FileCommandAnalyser)
c.register_encoder(Dragonfly::Encoding::TransparentEncoder)
end
Dragonfly.active_record_macro(:attachment, app)
DEPRECATION WARNING: RAILS_ROOT is deprecated. Please use ::Rails.root.to_s. (called from open at /home/ramon/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/open-uri.rb:35)
/home/ramon/.rvm/gems/ruby-1.9.2-p0@edric_rails3/gems/dragonfly-0.7.6/lib/dragonfly/configurable.rb:104:in `method_missing': You tried to configure using ':register_analyser', but the valid config attributes are ':analyser', ':cache_duration', ':cache_duration=', ':content_disposition', ':content_disposition=', ':content_filename', ':content_filename=', ':datastore', ':datastore=', ':encoder', ':fallback_mime_type', ':fallback_mime_type=', ':generator', ':infer_mime_type_from_file_ext', ':infer_mime_type_from_file_ext=', ':job', ':log', ':log=', ':processor', ':protect_from_dos_attacks', ':protect_from_dos_attacks=', ':register_mime_type', ':secret', ':secret=', ':url_host', ':url_host=', ':url_path_prefix', ':url_path_prefix=', ':url_suffix', ':url_suffix=' (Dragonfly::Configurable::BadConfigAttribute)
from /home/ramon/rails/edrich/config/initializers/dragonfly_attachments.rb:22:in `block in <top (required)>'
from /home/ramon/.rvm/gems/ruby-1.9.2-p0@edric_rails3/gems/dragonfly-0.7.6/lib/dragonfly/configurable.rb:33:in `configure'
from /home/ramon/.rvm/gems/ruby-1.9.2-p0@edric_rails3/gems/dragonfly-0.7.6/lib/dragonfly/configurable.rb:40:in `configure_with'
from /home/ramon/rails/edrich/config/initializers/dragonfly_attachments.rb:21:in `<top (required)>'
from /home/ramon/.rvm/gems/ruby-1.9.2-p0@edric_rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:235:in `load'
from /home/ramon/.rvm/gems/ruby-1.9.2-p0@edric_rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:235:in `block in load'
from /home/ramon/.rvm/gems/ruby-1.9.2-p0@edric_rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:227:in `load_dependency'
from /home/ramon/.rvm/gems/ruby-1.9.2-p0@edric_rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:235:in `load'
from /home/ramon/.rvm/gems/ruby-1.9.2-p0@edric_rails3/gems/railties-3.0.0/lib/rails/engine.rb:201:in `block (2 levels) in <class:Engine>'
from /home/ramon/.rvm/gems/ruby-1.9.2-p0@edric_rails3/gems/railties-3.0.0/lib/rails/engine.rb:200:in `each'
from /home/ramon/.rvm/gems/ruby-1.9.2-p0@edric_rails3/gems/railties-3.0.0/lib/rails/engine.rb:200:in `block in <class:Engine>'
from /home/ramon/.rvm/gems/ruby-1.9.2-p0@edrich_rails3/gems/railties-3.0.0/lib/rails/initializable.rb:25:in `instance_exec'
from /home/ramon/.rvm/gems/ruby-1.9.2-p0@edrich_rails3/gems/railties-3.0.0/lib/rails/initializable.rb:25:in `run'
from /home/ramon/.rvm/gems/ruby-1.9.2-p0@edrich_rails3/gems/railties-3.0.0/lib/rails/initializable.rb:50:in `block in run_initializers'
from /home/ramon/.rvm/gems/ruby-1.9.2-p0@edrich_rails3/gems/railties-3.0.0/lib/rails/initializable.rb:49:in `each'
from /home/ramon/.rvm/gems/ruby-1.9.2-p0@edrich_rails3/gems/railties-3.0.0/lib/rails/initializable.rb:49:in `run_initializers'
from /home/ramon/.rvm/gems/ruby-1.9.2-p0@edrich_rails3/gems/railties-3.0.0/lib/rails/application.rb:134:in `initialize!'
from /home/ramon/.rvm/gems/ruby-1.9.2-p0@edrich_rails3/gems/railties-3.0.0/lib/rails/application.rb:77:in `method_missing'
from /home/ramon/rails/edrich/config/environment.rb:5:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from /home/ramon/rails/edrich/test/test_helper.rb:2:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from /home/ramon/rails/edrich/test/unit/helpers/domains_helper_test.rb:1:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from -e:1:in `block in <main>'
from -e:1:in `each'
from -e:1:in `<main>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment