Trying to set max width to 1280 when above 600Kb and not a .gif:
has_attached_file :main_image,
:styles => {:original => "" },
:convert_options => {
:original => lambda { |instance| (instance.main_image_file_name.index(/\.gif/,-4).nil? && instance.main_image.size > 600000) ? "-resize 1280>" : "" }
},
:path => ":rails_root/public/system/:class/:attachment/:id_:basename.:extension",
:url => "/system/:class/:attachment/:id_:basename.:extension"
Getting this in my logs:
Command :: convert '/var/folders/hn/2q5wpxh52nn_3nk9wwskr48w0000gn/T/5827912cb359afd550a72bf4f54b109020141119-76993-1i6nij6.png[0]' -auto-orient -resize 1280> '/var/folders/hn/2q5wpxh52nn_3nk9wwskr48w0000gn/T/5827912cb359afd550a72bf4f54b109020141119-76993-1i6nij620141119-76993-q0m833'
sh: 1280: Bad file descriptor
[paperclip] An error was received while processing: #<Paperclip::Error: There was an error processing the thumbnail for 5827912cb359afd550a72bf4f54b109020141119-76993-1i6nij6>
Two issues here:
Paperclip w/ Rails will often require you to add \\ in front of < or > characters, as in 1280x\\>
Also, Paperclip always needs those x's, even when just doing width (1280x\\> and not 1280\\>).
Here's my full solution for setting max width to 1280 when above 600Kb and not a .gif:
has_attached_file :main_image,
:styles => {:original => "" },
:convert_options => {
:original => lambda { |instance| (instance.main_image_file_name.index(/\.gif/,-4).nil? && instance.main_image.size > 600000) ? "-resize 1280x\\>" : "" }
},
:path => ":rails_root/public/system/:class/:attachment/:id_:basename.:extension",
:url => "/system/:class/:attachment/:id_:basename.:extension"
Related
Using Paperclip Gem in a Rails 4 project to attach an image and then clean out all exif data, like this:
has_attached_file :image,
styles: lambda{ |a|
{
large: ['800x', :png],
thumb_340: ['340x340#', :png],
thumb_180: ['180x180#', :png]
}
},
convert_options: { all: '-strip' }
Problem is, convert_options isn't getting called on the original image. What's the best method for reprocessing (or pre-processing) the original to make sure that '-strip' gets called?
try this
has_attached_file :image,
styles: lambda{ |a|
{
original: {convert_options: '-strip'},
large: ['800x', :png],
thumb_340: ['340x340#', :png],
thumb_180: ['180x180#', :png]
}
}
I am trying to implement the steps to check and resize images with paperclip based on this blog post: http://www.techdarkside.com/how-to-re-size-images-that-are-too-large-on-the-fly-with-paperclip-and-rails
Here is what I have in place...
class Question < ActiveRecord::Base
# subclasses
class Question::Image < Asset
has_attached_file :attachment,
:url => "/uploads/:class/:attachment/:id_partition/:basename_:style.:extension",
:styles => Proc.new { |attachment| attachment.instance.styles },
:styles => Proc.new { |attachment| attachment.instance.resize }
attr_accessible :attachment
# http://www.ryanalynporter.com/2012/06/07/resizing-thumbnails-on-demand-with-paperclip-and-rails/
def dynamic_style_format_symbol
URI.escape(#dynamic_style_format).to_sym
end
def styles
unless #dynamic_style_format.blank?
{ dynamic_style_format_symbol => #dynamic_style_format }
else
{ :medium => "300x300>", :thumb => "100x100>" }
end
end
def dynamic_attachment_url(format)
#dynamic_style_format = format
attachment.reprocess!(dynamic_style_format_symbol) unless attachment.exists?(dynamic_style_format_symbol)
attachment.url(dynamic_style_format_symbol)
end
def resize
if self.attachment_file_size > 2000000
"300x300>"
else
" "
end
end
end
I'm thinking the issue is with the reuse of the :styles symbol, however I'm not sure how to work both the styles method AND the resize method into a single Proc statement.
Here is what I ended up with thanks to #janfoeh suggestion. I did need to add :originalto the options in style to get this to work. I also bumped the max file size up to 5mb.
class Question < ActiveRecord::Base
# subclasses
class Question::Image < Asset
has_attached_file :attachment,
:url => "/uploads/:class/:attachment/:id_partition/:basename_:style.:extension",
:styles => Proc.new { |attachment| attachment.instance.styles }
attr_accessible :attachment
# http://www.ryanalynporter.com/2012/06/07/resizing-thumbnails-on-demand-with-paperclip-and-rails/
def dynamic_style_format_symbol
URI.escape(#dynamic_style_format).to_sym
end
def styles
unless #dynamic_style_format.blank?
{ dynamic_style_format_symbol => #dynamic_style_format }
else
{ :original => resize, :medium => "300x300>", :thumb => "100x100>" }
end
end
def dynamic_attachment_url(format)
#dynamic_style_format = format
attachment.reprocess!(dynamic_style_format_symbol) unless attachment.exists?(dynamic_style_format_symbol)
attachment.url(dynamic_style_format_symbol)
end
def resize
if self.attachment_file_size > 5000000
"1000x1000>"
else
" "
end
end
end
After some research I was able to add styles based on my image_class column.
Model.rb
has_attached_file :image,
:styles => lambda { |attachment| attachment.instance.decide_styles }
def decide_styles
styles = {}
case self.image_class
when "poster"
styles[:thumb] = ["30x45!", :jpg]
styles[:standard] = ["185x278!", :jpg]
styles[:expanded] = ["372x559!", :jpg]
styles[:big] = ["600x900!", :jpg]
when "cover"
styles[:thumb] = ["30x45!", :jpg]
styles[:standard] = ["300x1200!", :jpg]
end
styles
end
This works smoothly, now I wanted to add conditional convert_options as well. This somehow fails.
has_attached_file :image,
:styles => lambda { |attachment| attachment.instance.decide_styles },
:convert_options => lambda { |attachment| attachment.instance.decide_convert_options }
def decide_styles
...
end
def decide_convert_options
opshunz = {}
case self.image_class
when "poster"
opshunz[:thumb] = "-flop"
opshunz[:standard] = "-flop"
opshunz[:expanded] = "-flop"
opshunz[:big] = "-flop"
when "cover"
opshunz[:thumb] = "-enhance"
opshunz[:standard] = "-enhance"
end
opshunz
end
Error:
NoMethodError: undefined method `instance' for :all:Symbol
from /Users/AnsPoluke/Sites/nulike/app/models/movie_image.rb:8:in `block in <class:MovieImage>'
from /Users/AnsPoluke/.rvm/gems/ruby-2.1.0/gems/paperclip-4.1.1/lib/paperclip/attachment.rb:431:in `[]'
from /Users/AnsPoluke/.rvm/gems/ruby-2.1.0/gems/paperclip-4.1.1/lib/paperclip/attachment.rb:431:in `process_options'
from /Users/AnsPoluke/.rvm/gems/ruby-2.1.0/gems/paperclip-4.1.1/lib/paperclip/attachment.rb:423:in `extra_options_for'
from /Users/AnsPoluke/.rvm/gems/ruby-2.1.0/gems/paperclip-4.1.1/lib/paperclip/style.rb:56:in `convert_options'
from /Users/AnsPoluke/.rvm/gems/ruby-2.1.0/gems/paperclip-4.1.1/lib/paperclip/style.rb:79:in `block in processor_options'
from /Users/AnsPoluke/.rvm/gems/ruby-2.1.0/gems/paperclip-4.1.1/lib/paperclip/style.rb:78:in `each'
from /Users/AnsPoluke/.rvm/gems/ruby-2.1.0/gems/paperclip-4.1.1/lib/paperclip/style.rb:78:in `processor_options'
from /Users/AnsPoluke/.rvm/gems/ruby-2.1.0/gems/paperclip-4.1.1/lib/paperclip/attachment.rb:462:in `block in post_process_style'
from /Users/AnsPoluke/.rvm/gems/ruby-2.1.0/gems/paperclip-4.1.1/lib/paperclip/attachment.rb:461:in `each'
from /Users/AnsPoluke/.rvm/gems/ruby-2.1.0/gems/paperclip-4.1.1/lib/paperclip/attachment.rb:461:in `inject'
from /Users/AnsPoluke/.rvm/gems/ruby-2.1.0/gems/paperclip-4.1.1/lib/paperclip/attachment.rb:461:in `post_process_style'
from /Users/AnsPoluke/.rvm/gems/ruby-2.1.0/gems/paperclip-4.1.1/lib/paperclip/attachment.rb:454:in `block in post_process_styles'
from /Users/AnsPoluke/.rvm/gems/ruby-2.1.0/gems/paperclip-4.1.1/lib/paperclip/attachment.rb:453:in `each'
from /Users/AnsPoluke/.rvm/gems/ruby-2.1.0/gems/paperclip-4.1.1/lib/paperclip/attachment.rb:453:in `post_process_styles'
from /Users/AnsPoluke/.rvm/gems/ruby-2.1.0/gems/paperclip-4.1.1/lib/paperclip/attachment.rb:445:in `block (2 levels) in post_process'
from /Users/AnsPoluke/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/callbacks.rb:393:in `_run__3861360263242897910__image_post_process__callbacks'
from /Users/AnsPoluke/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/callbacks.rb:80:in `run_callbacks'
from /Users/AnsPoluke/.rvm/gems/ruby-2.1.0/gems/paperclip-4.1.1/lib/paperclip/callbacks.rb:36:in `run_paperclip_callbacks'
from /Users/AnsPoluke/.rvm/gems/ruby-2.1.0/gems/paperclip-4.1.1/lib/paperclip/attachment.rb:443:in `block in post_process'
from /Users/AnsPoluke/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/callbacks.rb:383:in `_run__3861360263242897910__post_process__callbacks'
from /Users/AnsPoluke/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/callbacks.rb:80:in `run_callbacks'
from /Users/AnsPoluke/.rvm/gems/ruby-2.1.0/gems/paperclip-4.1.1/lib/paperclip/callbacks.rb:36:in `run_paperclip_callbacks'
from /Users/AnsPoluke/.rvm/gems/ruby-2.1.0/gems/paperclip-4.1.1/lib/paperclip/attachment.rb:442:in `post_process'
from /Users/AnsPoluke/.rvm/gems/ruby-2.1.0/gems/paperclip-4.1.1/lib/paperclip/attachment.rb:114:in `assign'
from /Users/AnsPoluke/.rvm/gems/ruby-2.1.0/gems/paperclip-4.1.1/lib/paperclip/has_attached_file.rb:66:in `block in define_setter'
from (irb):2
from /Users/AnsPoluke/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/commands/console.rb:90:in `start'
from /Users/AnsPoluke/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/commands/console.rb:9:in `start'
from /Users/AnsPoluke/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/commands.rb:62:in `<top (required)>'
from bin/rails:4:in `require'
Any ideas why it works perfectly with styles but fails with convert_options?
note: haven't verified that on working code
It seems that the argument to the block passed in :convert_options is already an instance, not the attachment (as opposed to styles option, where it is an attachment)
Try:
convert_options: lambda { |instance| instance.decide_convert_options }
Btw your code would look much better if you extract the configuration data, for example:
has_attached_file :image,
styles: lambda { |attachment| attachment.instance.image_options[:styles] },
convert_options: lambda { |instance| instance.image_options[:convert_options] }
IMAGE_OPTIONS = {
poster: {
styles: {
thumb: ["30x45!", :jpg],
standard: ["185x278!", :jpg],
expanded: ["372x559!", :jpg]
big: ["600x900!", :jpg]
},
convert_options: {
thumb: "-flop",
standard: "-flop",
expanded: "-flop",
big: = "-flop"
}
},
cover: {
styles: {
thumb: ["30x45!", :jpg],
standard: ["300x1200!", :jpg]
},
convert_options: {
thumb: "-enhance",
standard: "-enhance"
}
}
}
def image_options
IMAGE_OPTIONS[self.image_class]
end
I hope that helps
Update:
it looks like your convert_options are not being set here:
https://github.com/thoughtbot/paperclip/blob/a93dfc773b4fd649db4d1281b42a2a71b1ae72ff/lib/paperclip/style.rb#L55
it seems they recommend passing convert_options with styles, like in this spec: https://github.com/thoughtbot/paperclip/blob/263a498195d47563a6227be18cf4463c4c6e7903/spec/paperclip/style_spec.rb#L41
can you try this? so remove convert_options entirely, and in your configuration return hash like:
IMAGE_OPTIONS = {
poster: {
styles: {
thumb: {
geometry: "30x45!",
format: :jpg,
convert_options: '-flop',
},
standard: {...}
expanded: {...}
big: {...}
}
},
cover: {
styles: {...}
Apply it to all since that's what you're doing anyway?
:convert_options => {:all => "-flop"}
failing that you might be looking at creating a Paperclip Processor
The approved answer doesn't work. It can be read in the comments and the author acknowledges that it hasn't been tested in code.
This code does work:
has_attached_file :image,
:styles => lambda { |attachment|
thumb_convert_options = case attachment.instance.image_class
when "poster"
"-flop"
when "cover"
"-enhance"
end
{
thumb: {
convert_options: thumb_convert_options
}
}
}
The correct approach is to have convert_options inside the styles lambda; having it as a separate lambda does not work, at least for Paperclip version 4.1 and higher.
To keep my answer in one place, I've put all the code inline and omitted all styles beside thumb. Obviously to implement this you should keep the method decide_convert_options.
You can also specify convert_options in styles:
class Image < ActiveRecord::Base
has_attached_file :image, styles: -> (attachment) { attachment.instance.paperclip_styles }
private
def image_ratio
# logic to define the image ratio
end
def paperclip_styles
vitrina_geometry = image_ratio > 1.2 ? '268x156>' : '268x156^'
vitrina_convert_options = if image_ratio > 1.2
"-quality 75 -gravity center -crop '268x156+0+0'"
else
"-quality 75 -strip -gravity center -background '#FFFFFF' -extent 268x156"
end
{
medium: {
geometry: '500x500>',
convert_options: '-quality 75 -strip'
},
thumb: {
geometry: '256x148>',
convert_options: '-quality 75 -strip'
},
small: {
geometry: '120x120>',
convert_options: '-quality 75 -strip'
},
course_thumb: {
geometry: '395x220^',
convert_options: '-quality 75 -gravity center -crop \'395x220+0+0\''
},
:vitrina => {
geometry: vitrina_geometry,
convert_options: vitrina_convert_options
}
}
end
end
Add the convert_options into the styles themselves. Here is an example for a generic rails Image model which contains two styles and corresponding booleans to enable these styles.
# == Schema Information
#
# Table name: images
#
# id :integer not null, primary key
# image_file_name :string(255)
# image_content_type :string(255)
# image_file_size :integer
# hero_style :boolean
# thumb_style :boolean
# image_updated_at :datetime
# created_at :datetime not null
# updated_at :datetime not null
#
class Image < ActiveRecord::Base
# These are the postprocessing options.
# The boolean <stylename>_style? attributes controls which styles are created.
STYLES = {
hero: {geometry: "2500x800#", convert_options: "-quality 75 -strip", source_file_options: ""},
thumb: {geometry: "312x100#", convert_options: "-quality 75 -strip", source_file_options: ""}
}
has_attached_file :image,
styles:
lambda { |file|
r = {}
STYLES.keys.each do |stylename|
r[stylename] = STYLES[stylename] if file.instance.method("%s_style?" % stylename).call
end
return r
}
validates_attachment :image, :presence => true,
content_type: { content_type: ["image/jpeg", "image/png"] },
file_name: {matches: [/png\Z/, /jpe?g\Z/]}
end
I want Paperclip to crop, and not scale (see :full1 in this excerpt)
class Graphic < ActiveRecord::Base
has_attached_file :image, :styles => { :full0 => "940x1000#" #want it to scale, and crop if neccessary
:full1 => "940#", #want it to crop width, not scale
}
I want :full1 to work, but it doesn't. By "work" I mean it should crop the image's width, but do nothing to it's height. The reason is I'm uploading web screenshots, and I want them to be trimmed to 940px wide (from the center), but their height should remain intact. As far as what I research on paperclip I'm not finding how to do this.
Apparently it's quite supported by ImageMagick: http://www.imagemagick.org/Usage/crop/#crop_strip But I don't know how to jam this into paperclip on rails.
Many thanks!
Could you just set the height to something absurdly large so that it will be a non-issue?
class Graphic < ActiveRecord::Base
has_attached_file :image, :styles => { :full0 => "940x1000#" #want it to scale, and crop if neccessary
:full1 => "940x9999999#", #want it to crop width, not scale
}
I think that will crop anything wider than 940px.
You can user convert options for image process, Following will crop the image centrally.
has_attached_file :profile_picture, :storage => :s3,
:styles => { :medium => "", :thumb => ""},
:convert_options => {
:thumb => Proc.new { |instance| instance.thumnail_dimension },
:medium => Proc.new { |instance| instance.thumnail_dimension(300) }
}
def thumnail_dimension(size=100)
dimensions = Paperclip::Geometry.from_file(profile_picture.queued_for_write[:original].path)
min = dimensions.width > dimensions.height ? dimensions.height : dimensions.width
"-gravity Center -crop #{min}x#{min}+0+0 +repage -resize #{size}x#{size}^"
end
I have a rails 3 app with paperclip. The model looks a little like:
class Attachment < ActiveRecord::Base
has_attached_file :attachment,
:styles => {
:large => '1024x758>',
:medium => "200x150#",
:thumb => "100x75#",
:small => "50x50>"
},
:default_style => :original,
:default_url => '/images/:attachment/default_:style.png',
:path => ":instance_id/:attachment/:id/:style/:basename.:extension",
:storage => :s3,
:s3_credentials => File.join(Rails.root, 'config', 's3.yml'),
:s3_protocol => 'https',
:s3_permissions => :private,
:use_timestamp => false
def authenticated_url(style = nil, expires_in = 90.minutes)
AWS::S3::S3Object.url_for(attachment.path(style || attachment.default_style), attachment.bucket_name, :expires_in => expires_in, :use_ssl => attachment.s3_protocol == 'https')
end
This is called from a user_mailer which is called via delayed_job:
In user_mailer.rb mailer it looks a little something like this:
#comment.attachments.each do |a|
attachments[a.attachment_file_name] = open(a.authenticated_url()) {|f| f.read }
end
The issue here is that delayed mailer is erroring with:
{uninitialized constant Attachment::AWS
/Users/bhellman/Sites/cline/app/models/attachment.rb:53:in `authenticated_url'\n/Users/bhellman/Sites/cline/app/mailers/user_mailer.rb:41:in
`conversation_notification'\n/Library/Ruby/Gems/1.8/gems/activerecord-3.0.0/lib/active_record/associations/association_collection.rb:430:in
`method_missing'\n/Library/Ruby/Gems/1.8/gems/activerecord-3.0.0/lib/active_record/associations/association_proxy.rb:216:in `method_missing'\n/
Library/Ruby/Gems/1.8/gems/activerecord-3.0.0/lib/active_record/associations/association_proxy.rb:216:in
`each'\n/Library/Ruby/Gems/1.8/gems/activerecord-3.0.0/lib/active_record/associations/association_proxy.rb:216:in
`send'\n/Library/Ruby/Gems/1.8/gems/activerecord-3.0.0/lib/active_record/associations/association_proxy.rb:216:in `method_missing'\n/Library/Ruby/Gems/1.8/gems/activerecord-3.0.0/lib/active_record/associations/association_collection.rb:430:in `method_missing'\n/Users/bhellman/Sites/cline/app/mailers/user_mailer.rb:39:in `conversation_notification'\n/Library/Ruby/Gems/1.8/gems/actionpack-3.0.0/lib/abstract_controller/base.rb:150:in `send_action'\n/Library/Ruby/Gems/1.8/gems/actionpack-3.0.0/lib/abstract_controller/base.rb:150:in `process_action'\n/Library/Ruby/Gems/1.8/gems/actionpack-3.0.0/lib/abstract_controller/base.rb:119:in `process'\n/Library/Ruby/Gems/1.8/gems/actionpack-3.0.0/lib/abstract_controller/rendering.rb:40:in `process'\n/Library/Ruby/Gems/1.8/gems/actionmailer-3.0.0/lib/action_mailer/old_api.rb:75:in `process'\n/Library/Ruby/Gems/1.8/gems/actionmailer-3.0.0/lib/action_mailer/base.rb:446:in `process'\n/Library/Ruby/Gems/1.8/gems/actionmailer-3.0.0/lib/action_mailer/base.rb:441:in `initialize'\n/Library/Ruby/Gems/1.8/gems/actionmailer-3.0.0/lib/action_mailer/base.rb:425:in `new'\n/Library/Ruby/Gems/1.8/gems/actionmailer-3.0.0/lib/action_mailer/base.rb:425:in `method_missing'\n/Library/Ruby/Gems/1.8/bundler/gems/delayed_job-411719b38c51/lib/delayed/performable_mailer.rb:6:in `send'\n/Library/Ruby/Gems/1.8/bundler/gems/delayed_job-411719b38c51/lib/delayed/performable_mailer.rb:6:in `perform'\n/Library/Ruby/Gems/1.8/bundler/gems/delayed_job-411719b38c51/lib/delayed/backend/base.rb:83:in `invoke_job'\n/Library/Ruby/Gems/1.8/bundler/gems/delayed_job-411719b38c51/lib/delayed/worker.rb:119:in `run'\n/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/timeout.rb:62:in `timeout'\n/Library/Ruby/Gems/1.8/bundler/gems/delayed_job-411719b38c51/lib/delayed/worker.rb:119:in `run'\n/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'\n/Library/Ruby/Gems/1.8/bundler/gems/delayed_job-411719b38c51/lib/delayed/worker.rb:118:in `run'\n/Library/Ruby/Gems/1.8/bundler/gems/delayed_job-411719b38c51/lib/delayed/worker.rb:176:in `reserve_and_run_one_job'\n/Library/Ruby/Gems/1.8/bundler/gems/delayed_job-411719b38c51/lib/delayed/worker.rb:103:in `work_off'\n/Library/Ruby/Gems/1.8/bundler/gems/delayed_job-411719b38c51/lib/delayed/worker.rb:102:in `times'\n/Library/Ruby/Gems/1.8/bundler/gems/delayed_job-411719b38c51/lib/delayed/worker.rb:102:in `work_off'\n/Library/Ruby/Gems/1.8/bundler/gems/delayed_job-411719b38c51/lib/delayed/worker.rb:77:in `start'\n/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'\n/Library/Ruby/Gems/1.8/bundler/gems/delayed_job-411719b38c51/lib/delayed/worker.rb:76:in `start'\n/Library/Ruby/Gems/1.8/bundler/gems/delayed_job-411719b38c51/lib/delayed/worker.rb:73:in `loop'\n/Library/Ruby/Gems/1.8/bundler/gems/delayed_job-411719b38c51/lib/delayed/worker.rb:73:in `start'\n/Library/Ruby/Gems/1.8/bundler/gems/delayed_job-411719b38c51/lib/delayed/tasks.rb:9\n/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'\n/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'\n/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'\n/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'\n/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'\n/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'\n/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'\n/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'\n/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'\n/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'\n/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'\n/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'\n/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'\n/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'\n/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'\n/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'\n/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'\n/Library/Ruby/Gems/1.8/gems/rake-0.8.7/bin/rake:31\n/usr/bin/rake:19:in `load'\n/usr/bin/rake:19
Any idea what could be going on?
You need to require "aws/s3" in your model.