Fwd: acts_attachment_problem

---------- Forwarded message ----------
From: Charlie B. [email protected]
Date: Sep 15, 2006 9:34 PM
Subject: acts_attachment_problem
To: [email protected]

I’m having trouble with acts_attachment. I’m getting validation errors
when
attempting to save. I have installed imagemagick and rmagick. I"m on
fedora core 4 and running edge rails.

Validation failed: Content type is not included in the list, Content
type can’t be blank, Size is not included in the list, Size can’t be
blank, Filename can’t be blank

MODEL
class Photo < ActiveRecord::Base
belongs_to :article
acts_as_attachment :storage => :file_system,
:file_system_path =>
‘/var/www/dragonfly/public/files’,
:size => 1.byte…300.kilobytes,
:content_type => :image,
:thumbnails => { :thumb => [50, 50], :geometry =>
‘x50’ },
:resize_to => [55,55]
validates_as_attachment

after_resize do |record, img|
record.aspect_ratio = img.columns.to_f / img.rows.to_f
end
end

VIEW
<%= start_form_tag :action => ‘create’, :html => { :multipart => true }
-%>

Headline
<%= text_field 'article', 'headline' %>

<%= file_field 'photo', :uploaded_data %>

Category
<%= options = [["Choose a article category", ""]] + @categories logger.error("category" + @ article.category_id.to_s) select("article", "category_id", options) %>

Tags (Tag this article with any sub-categories you need. Seperate them with a comma.)
<%= text_field_tag 'tag_list', @article.tags.collect{|t| t.name}.join(", "), :size => 40 %>

Article Body
<%= text_area 'article', 'raw_body' %>

<%= end_form_tag %>

CONTROLLER
def create
@photo = Photo.create!(params[:uploaded_data])
@categories = Category.category_array
@article = Article.new(params[:article])
@article.tag_with(params[:tag_list],@current_user)
@article.user_id = @current_user.id
if @article.save
flash[:notice] = ‘Article was successfully created.’
redirect_to :action => ‘list’
else
render :layout => false
end
end