2012-04-10 62 views
0

heeey) 我试图让一个画廊,但我得到的文件中的错误上传画廊FO BCMS 3.3.3错误 - Ruby on Rails的

模型gallery.rb

class Gallery < ActiveRecord::Base 
    acts_as_content_block 
    has_attached_file :avatar, :styles => { :thumb => "291x191#" } 

    #attr_accessible :images 
    has_many :images 
    accepts_nested_attributes_for :images, :allow_destroy => true 
end 

模型图像! .RB

class Image < ActiveRecord::Base 
belongs_to :gallery 
#acts_as_content_block :belongs_to_gallery => true 
has_attached_file :image, :styles => { :large => "640x480", :medium => "300x300>", :small => "100x100>" } 
end 

_form.html.erb

<p> Hello world!</p> 

<%= f.cms_text_field :name %> 
<%= f.cms_text_area :description %> 
<%= f.cms_file_field :avatar, :label => "Avatar" %> 

<% f.object.images.build %> 
<%= f.fields_for :images, :html => { :multipart => true } do |image| %> 
<%= image.file_field :image, :label => "Child Avatar" %> 
<% end %> 

================================================ ========

Started POST "/cms/galleries/14" for 91.2**.41.*** at 2012-04-10 01:28:14 +0400 
    Processing by Cms::GalleriesController#update as HTML 
    Parameters: {"utf8"=>"✓", "authenticity_token"=>"ziD3527h0JynfX05FcpnVgjsPSz2rGP4MKbEDmOun4U=", "gallery"=>{"lock_version"=>"0", "connect_to_page_id"=>"", "connect_to_container"=>"", "name"=>"Галерея", "description"=>"", "images_attributes"=>{"0"=>{"image"=>#<ActionDispatch::Http::UploadedFile:0x000000047a2570 @original_filename="загруженное.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"gallery[images_attributes][0][image]\"; filename=\"\xD0\xB7\xD0\xB0\xD0\xB3\xD1\x80\xD1\x83\xD0\xB6\xD0\xB5\xD0\xBD\xD0\xBD\xD0\xBE\xD0\xB5.jpg\"\r\nContent-Type: image/jpeg\r\n", @tempfile=#<File:/tmp/RackMultipart20120410-18330-3iyv20>>}}, "publish_on_save"=>"true"}, "id"=>"14"} 
Command :: identify -format %wx%h '/tmp/загруженное.jpg20120410-18330-4sshl[0]' 
Command :: convert '/tmp/загруженное.jpg20120410-18330-4sshl[0]' -resize "640x480" '/tmp/загруженное20120410-18330-tfa27r' 
Command :: identify -format %wx%h '/tmp/загруженное.jpg20120410-18330-4sshl[0]' 
Command :: convert '/tmp/загруженное.jpg20120410-18330-4sshl[0]' -resize "300x300>" '/tmp/загруженное20120410-18330-h8iclv' 
Command :: identify -format %wx%h '/tmp/загруженное.jpg20120410-18330-4sshl[0]' 
Command :: convert '/tmp/загруженное.jpg20120410-18330-4sshl[0]' -resize "100x100>" '/tmp/загруженное20120410-18330-el6pk' 
Redirected to http://*********/cms/galleries/14 
Completed 302 Found in 218ms 

帮我plzzzz =(((

回答

0

确保表有字段或没有。

画廊:

:avatar_file_name 
:avatar_content_type 
:avatar_file_size 

图片:

:image_file_name 
:image_content_type 
:image_file_size 

就以Paperclip: Attaching Files in Rails

+0

是的一看,桌子有回形针所有字段( – 2012-04-10 10:00:06

+0

请你们帮我=((( ( – 2012-04-10 12:22:24

+0

你能不能让我知道到底发生了什么错误......没有想到你的日志给了 。 – Vik 2012-04-10 12:31:42