Hi,
I am attempting to replace an exiting photo with a new one uploaded by
the user. I am using attachment_fu and I am coming up with the
following exception:
can''t convert nil into String
/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/file_system_backend.rb:23:in
`join''
/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/file_system_backend.rb:23:in
`full_filename''
/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu.rb:369:in
`temp_paths''
/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu.rb:354:in
`uploaded_data=''
My ruby code:
<% form_for(@photo) do |f| %>
<%= f.error_messages %>
<%= image_tag(@photo.public_filename, :BORDER=>0) %>
<p>
<label for="upload">Upload new photo:</label>
<%= f.file_field :uploaded_data %>
<%= f.submit ''Update'' %>
</p>
<% end %>
My rails code:
def edit
@photo = Photo.find(params[:id])
end
def update
@photo = Photo.find(params[:id])
if @photo.update_attributes(params[:photo])
flash[:notice] = ''Photo was successfully updated.''
redirect_to(''/listingHome/active/edit/'' +
@photo.lisitng_id)
end
end
Method failing in attachement_fu
# Gets the full path to the filename in this format:
#
# # This assumes a model name like MyModel
# # public/#{table_name} is the default filesystem path
# RAILS_ROOT/public/my_models/5/blah.jpg
#
# Overwrite this method in your model to customize the filename.
# The optional thumbnail argument will output the thumbnail''s filename.
def full_filename(thumbnail = nil)
file_system_path = (thumbnail ? thumbnail_class :
self).attachment_options[:path_prefix].to_s
File.join(RAILS_ROOT, file_system_path,
*partitioned_path(thumbnail_name_for(thumbnail)))
end
Anybody have an idea what I am doing wrong?
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.