class AlbumSong < ActiveRecord::Base
MAX_SIZE_IN_MB = 10
has_attachment :content_type => ‘audio/mp3’,
:storage => :s3,
:max_size => MAX_SIZE_IN_MB.megabytes
acts_as_indexed :fields => [:title, :author],
:index_file => [Rails.root.to_s, “tmp”, “index”]
belongs_to :album
validates_presence_of :title
validates_uniqueness_of :title
end
When update a model without file, it appears the following error. How
can I solve?
TypeError: can’t convert nil into String
from
/home/marcelo/hueb/bandas/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/s3_backend.rb:262:in
join' from /home/marcelo/hueb/bandas/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/s3_backend.rb:262:in
full_filename’
from
/home/marcelo/hueb/bandas/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu.rb:367:in
temp_paths' from /home/marcelo/hueb/bandas/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu.rb:361:in
temp_path’
from
/home/marcelo/hueb/bandas/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu.rb:320:in
save_attachment?' from /home/marcelo/hueb/bandas/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu.rb:424:in
set_size_from_temp_path’
from
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:178:in
send' from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:178:in
evaluate_method’
from
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:166:in
call' from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:93:in
run’
from
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:92:in
each' from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:92:in
send’
from
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:92:in
run' from /home/marcelo/hueb/bandas/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu.rb:492:in
run_callbacks’
from
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/callbacks.rb:344:in
callback' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/callbacks.rb:311:in
valid?’
from
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/validations.rb:1077:in
save_without_dirty' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/dirty.rb:79:in
save_without_transactions’
from
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/transactions.rb:229:in
send' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/transactions.rb:229:in
with_transaction_returning_status’
from
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in
transaction' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/transactions.rb:182:in
transaction’
from
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/transactions.rb:228:in
with_transaction_returning_status' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/transactions.rb:196:in
save’
from
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/transactions.rb:208:in
rollback_active_record_state!' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/transactions.rb:196:in
save’
from (irb):4>>