---------- Forwarded message ---------- From: Charlie Bowman <charlesmbowman-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Date: Sep 15, 2006 9:34 PM Subject: acts_attachment_problem To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org 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 } -%> <p><label for="article_headline">Headline</label><br/> <%= text_field ''article'', ''headline'' %></p> <p><%= file_field ''photo'', :uploaded_data %></p> <p><label for="article_category_id">Category</label><br /> <%= options = [["Choose a article category", ""]] + @categories logger.error("category" + @ article.category_id.to_s) select("article", "category_id", options) %></p> <p><label for="article_tags">Tags (Tag this article with any sub-categories you need. Seperate them with a comma.)</label><br /> <%= text_field_tag ''tag_list'', @article.tags.collect{|t| t.name}.join(", "), :size => 40 %></p> <p><label for="article_raw_body">Article Body</label><br/> <%= text_area ''article'', ''raw_body'' %></p> <%= 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 --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---