Attachment_fu problem

Rails noob here,
I am having trouble getting a simple attachment_fu file upload form to
work. I am using Mike C.'s tutorial on attachment_fu -
http://clarkware.com/cgi/blosxom/2007/02/24 . My code is the same as
the tutorial but with a few minor naming conditions that are different
and the form. I have RMagick installed and it’s dependencies as well
as the attachment_fu plugin. It’s not saving in the controller and I
am getting the message “there was a problem”. I am not getting any
Rails or Ruby errors. Can anyone help…here is my code:

new.rhtml :

   <% if flash[:notice] -%>
<div id="notice"><%= flash[:notice] %></div>

<% end -%>

<% form_tag( {:action=>‘create’}, :multipart=>true ) do -%>


Upload A Photo:
<%= file_field_tag(:uploaded_data) %>



<%= submit_tag ‘Create’ %>


<% end -%>

lodge_photo.rhtml :

class LodgePhoto < ActiveRecord::Base
has_attachment :content_type => :image,
:storage => :file_system,
:max_size => 500.kilobytes,
:resize_to => ‘320x200>’,
:thumbnails => { :thumb => ‘100x100>’ }

validates_as_attachment
end

lodge_photos_controller.rb :

class LodgePhotosController < ApplicationController

def new
end

def show
@lodge_photos = LodgePhoto.find(:all)
end

def create

@lodge_photo = LodgePhoto.new(params[:lodge_photo])

if @lodge_photo.save
  flash[:notice] = 'Photo saved successfully!'
  render :action => "show"
else
  flash[:notice] = 'There was a problem!'
  render :action => "new"
end

end
end

DB Migration:

class CreateLodgePhotos < ActiveRecord::Migration
def self.up
create_table :lodge_photos do |t|
t.column :parent_id, :integer
t.column :content_type, :string
t.column :filename, :string
t.column :thumbnail, :string
t.column :size, :integer
t.column :width, :integer
t.column :height, :integer
end
end

def self.down
  drop_table :lodge_photos
end

end

On 7/22/07, Acroterra [email protected] wrote:

Rails noob here,
I am having trouble getting a simple attachment_fu file upload form to
work. I am using Mike C.'s tutorial on attachment_fu -
http://clarkware.com/cgi/blosxom/2007/02/24 . My code is the same as
the tutorial but with a few minor naming conditions that are different
and the form. I have RMagick installed and it’s dependencies as well
as the attachment_fu plugin. It’s not saving in the controller and I
am getting the message “there was a problem”. I am not getting any
Rails or Ruby errors. Can anyone help…here is my code:

When an active record model doesn’t save it means: either a
before_save callback returned false, or there were validation errors.
You’re not showing any validation errors in the new.rhtml view:

<%= error_messages_for :whatever %>

Thomas Beck wrote up some issues with using this plugin on windows:
http://www.beckshome.com/PermaLink,guid,8fc9bb84-3f9e-4d11-aa48-fa042b4806fd.aspx
If anyone can suggest fixes, send them in as patches please. I don’t
have a windows machine handy at the moment.


Rick O.
http://lighthouseapp.com
http://weblog.techno-weenie.net
http://mephistoblog.com