2014-02-25 226 views
5

我用Activeadmin,回形針和Rails 4 當我想創建多圖像的新文章中,我有這樣的錯誤:Activeadmin和回形針:引發ArgumentError

ArgumentError in Admin::Articles#new 
wrong number of arguments (1 for 0) 

當我嘗試只用一個形象我有同樣的錯誤。

ActiveAdmin:article.rb

ActiveAdmin.register Article do 

    controller do 
    def permitted_params 
     params.permit article: [:title, :images_attributes => [:picture, :id, :_destroy]] 
    end 
    end 

    form do |f| 
    f.inputs "Project Details" do 
     f.input :title 
     f.has_many :images do |p| 
     p.inputs do 
      p.input :_destroy, :as => :boolean, :label => "Destroy?" unless p.object.new_record? 
      p.input :picture, :as => :file, :hint => p.object.new_record? ? "" : f.template.image_tag(p.object.picture.url(:thumb)) 
     end 
     end 
    end 
    f.actions 
    end 
end 

型號:article.rb

class Article < ActiveRecord::Base 
    has_many :images, :dependent => :destroy 
    accepts_nested_attributes_for :images, :allow_destroy => true 
end 

型號:image.rb

class Image < ActiveRecord::Base 
    belongs_to :article 
    has_attached_file :picture, :styles => { :large => "960x640>", :medium => "300x300>", :thumb => "150x150>" }, :default_url => "/images/:style/missing.png" 
end 

遷移:

class CreateImages < ActiveRecord::Migration 
    def change 
    create_table :images do |t| 
     t.belongs_to :article 
     t.attachment :picture 
     t.timestamps 
    end 
    end 
end 

我的錯誤的全面跟蹤:

paperclip (4.1.1) lib/paperclip/has_attached_file.rb:83:in `block in add_required_validations' 
formtastic (2.3.0.rc2) lib/formtastic/inputs/base/validations.rb:39:in `call' 
formtastic (2.3.0.rc2) lib/formtastic/inputs/base/validations.rb:39:in `validator_relevant?' 
formtastic (2.3.0.rc2) lib/formtastic/inputs/base/validations.rb:27:in `block in validations' 
formtastic (2.3.0.rc2) lib/formtastic/inputs/base/validations.rb:26:in `select' 
formtastic (2.3.0.rc2) lib/formtastic/inputs/base/validations.rb:26:in `validations' 
formtastic (2.3.0.rc2) lib/formtastic/inputs/base/validations.rb:129:in `validations?' 
formtastic (2.3.0.rc2) lib/formtastic/inputs/base/validations.rb:136:in `required?' 
formtastic (2.3.0.rc2) lib/formtastic/inputs/base/labelling.rb:25:in `requirement_text_or_proc' 
formtastic (2.3.0.rc2) lib/formtastic/inputs/base/labelling.rb:29:in `requirement_text' 
formtastic (2.3.0.rc2) lib/formtastic/inputs/base/labelling.rb:20:in `label_text' 
formtastic (2.3.0.rc2) lib/formtastic/inputs/base/labelling.rb:9:in `label_html' 
formtastic (2.3.0.rc2) lib/formtastic/inputs/file_input.rb:36:in `block in to_html' 
actionpack (4.0.2) lib/action_view/helpers/capture_helper.rb:38:in `block in capture' 
actionpack (4.0.2) lib/action_view/helpers/capture_helper.rb:200:in `with_output_buffer' 
actionpack (4.0.2) lib/action_view/helpers/capture_helper.rb:38:in `capture' 
formtastic (2.3.0.rc2) lib/formtastic/inputs/base/wrapping.rb:11:in `input_wrapping' 
formtastic (2.3.0.rc2) lib/formtastic/inputs/file_input.rb:35:in `to_html' 
formtastic (2.3.0.rc2) lib/formtastic/helpers/input_helper.rb:241:in `input' 
/home/bibou/.rvm/gems/ruby-2.0.0-p353/bundler/gems/active_admin-66de2f86ae1d/lib/active_admin/form_builder.rb:26:in `block in input' 
/home/bibou/.rvm/gems/ruby-2.0.0-p353/bundler/gems/active_admin-66de2f86ae1d/lib/active_admin/form_builder.rb:151:in `with_new_form_buffer' 
/home/bibou/.rvm/gems/ruby-2.0.0-p353/bundler/gems/active_admin-66de2f86ae1d/lib/active_admin/form_builder.rb:26:in `input' 
app/admin/article.rb:16:in `block (5 levels) in <top (required)>' 
/home/bibou/.rvm/gems/ruby-2.0.0-p353/bundler/gems/active_admin-66de2f86ae1d/lib/active_admin/form_builder.rb:143:in `block in field_set_and_list_wrapping' 
actionpack (4.0.2) lib/action_view/helpers/capture_helper.rb:38:in `block in capture' 
actionpack (4.0.2) lib/action_view/helpers/capture_helper.rb:200:in `with_output_buffer' 
actionpack (4.0.2) lib/action_view/helpers/capture_helper.rb:38:in `capture' 
formtastic (2.3.0.rc2) lib/formtastic/helpers/fieldset_wrapper.rb:32:in `field_set_and_list_wrapping' 
/home/bibou/.rvm/gems/ruby-2.0.0-p353/bundler/gems/active_admin-66de2f86ae1d/lib/active_admin/form_builder.rb:142:in `field_set_and_list_wrapping' 
formtastic (2.3.0.rc2) lib/formtastic/helpers/inputs_helper.rb:292:in `inputs' 
/home/bibou/.rvm/gems/ruby-2.0.0-p353/bundler/gems/active_admin-66de2f86ae1d/lib/active_admin/form_builder.rb:20:in `block in inputs' 
/home/bibou/.rvm/gems/ruby-2.0.0-p353/bundler/gems/active_admin-66de2f86ae1d/lib/active_admin/form_builder.rb:151:in `with_new_form_buffer' 
/home/bibou/.rvm/gems/ruby-2.0.0-p353/bundler/gems/active_admin-66de2f86ae1d/lib/active_admin/form_builder.rb:20:in `inputs' 
app/admin/article.rb:14:in `block (4 levels) in <top (required)>' 
/home/bibou/.rvm/gems/ruby-2.0.0-p353/bundler/gems/active_admin-66de2f86ae1d/lib/active_admin/form_builder.rb:61:in `call' 
/home/bibou/.rvm/gems/ruby-2.0.0-p353/bundler/gems/active_admin-66de2f86ae1d/lib/active_admin/form_builder.rb:61:in `block in has_many' 
formtastic (2.3.0.rc2) lib/formtastic/helpers/inputs_helper.rb:375:in `call' 
formtastic (2.3.0.rc2) lib/formtastic/helpers/inputs_helper.rb:375:in `block (2 levels) in inputs_for_nested_attributes' 
/home/bibou/.rvm/gems/ruby-2.0.0-p353/bundler/gems/active_admin-66de2f86ae1d/lib/active_admin/form_builder.rb:143:in `block in field_set_and_list_wrapping' 
actionpack (4.0.2) lib/action_view/helpers/capture_helper.rb:38:in `block in capture' 
actionpack (4.0.2) lib/action_view/helpers/capture_helper.rb:200:in `with_output_buffer' 
actionpack (4.0.2) lib/action_view/helpers/capture_helper.rb:38:in `capture' 
formtastic (2.3.0.rc2) lib/formtastic/helpers/fieldset_wrapper.rb:32:in `field_set_and_list_wrapping' 
/home/bibou/.rvm/gems/ruby-2.0.0-p353/bundler/gems/active_admin-66de2f86ae1d/lib/active_admin/form_builder.rb:142:in `field_set_and_list_wrapping' 
formtastic (2.3.0.rc2) lib/formtastic/helpers/inputs_helper.rb:292:in `inputs' 
/home/bibou/.rvm/gems/ruby-2.0.0-p353/bundler/gems/active_admin-66de2f86ae1d/lib/active_admin/form_builder.rb:20:in `block in inputs' 
/home/bibou/.rvm/gems/ruby-2.0.0-p353/bundler/gems/active_admin-66de2f86ae1d/lib/active_admin/form_builder.rb:151:in `with_new_form_buffer' 
/home/bibou/.rvm/gems/ruby-2.0.0-p353/bundler/gems/active_admin-66de2f86ae1d/lib/active_admin/form_builder.rb:20:in `inputs' 
formtastic (2.3.0.rc2) lib/formtastic/helpers/inputs_helper.rb:373:in `block in inputs_for_nested_attributes' 
actionpack (4.0.2) lib/action_view/helpers/capture_helper.rb:38:in `block in capture' 
actionpack (4.0.2) lib/action_view/helpers/capture_helper.rb:200:in `with_output_buffer' 
actionpack (4.0.2) lib/action_view/helpers/capture_helper.rb:38:in `capture' 
actionpack (4.0.2) lib/action_view/helpers/form_helper.rb:1864:in `block in fields_for_nested_model' 
actionpack (4.0.2) lib/action_view/helpers/capture_helper.rb:38:in `block in capture' 
actionpack (4.0.2) lib/action_view/helpers/capture_helper.rb:200:in `with_output_buffer' 
actionpack (4.0.2) lib/action_view/helpers/capture_helper.rb:38:in `capture' 
actionpack (4.0.2) lib/action_view/helpers/form_helper.rb:699:in `fields_for' 
actionpack (4.0.2) lib/action_view/helpers/form_helper.rb:1863:in `fields_for_nested_model' 
actionpack (4.0.2) lib/action_view/helpers/form_helper.rb:1849:in `block in fields_for_with_nested_attributes' 
actionpack (4.0.2) lib/action_view/helpers/form_helper.rb:1847:in `each' 
actionpack (4.0.2) lib/action_view/helpers/form_helper.rb:1847:in `fields_for_with_nested_attributes' 
actionpack (4.0.2) lib/action_view/helpers/form_helper.rb:1521:in `fields_for' 
formtastic (2.3.0.rc2) lib/formtastic/helpers/inputs_helper.rb:391:in `inputs_for_nested_attributes' 
/home/bibou/.rvm/gems/ruby-2.0.0-p353/bundler/gems/active_admin-66de2f86ae1d/lib/active_admin/form_builder.rb:176:in `block in js_for_has_many' 
/home/bibou/.rvm/gems/ruby-2.0.0-p353/bundler/gems/active_admin-66de2f86ae1d/lib/active_admin/form_builder.rb:151:in `with_new_form_buffer' 
/home/bibou/.rvm/gems/ruby-2.0.0-p353/bundler/gems/active_admin-66de2f86ae1d/lib/active_admin/form_builder.rb:176:in `js_for_has_many' 
/home/bibou/.rvm/gems/ruby-2.0.0-p353/bundler/gems/active_admin-66de2f86ae1d/lib/active_admin/form_builder.rb:99:in `block in has_many' 
/home/bibou/.rvm/gems/ruby-2.0.0-p353/bundler/gems/active_admin-66de2f86ae1d/lib/active_admin/form_builder.rb:160:in `block in without_wrapper' 
/home/bibou/.rvm/gems/ruby-2.0.0-p353/bundler/gems/active_admin-66de2f86ae1d/lib/active_admin/form_builder.rb:151:in `with_new_form_buffer' 
/home/bibou/.rvm/gems/ruby-2.0.0-p353/bundler/gems/active_admin-66de2f86ae1d/lib/active_admin/form_builder.rb:160:in `without_wrapper' 
/home/bibou/.rvm/gems/ruby-2.0.0-p353/bundler/gems/active_admin-66de2f86ae1d/lib/active_admin/form_builder.rb:90:in `has_many' 
app/admin/article.rb:13:in `block (3 levels) in <top (required)>' 
/home/bibou/.rvm/gems/ruby-2.0.0-p353/bundler/gems/active_admin-66de2f86ae1d/lib/active_admin/form_builder.rb:143:in `block in field_set_and_list_wrapping' 
actionpack (4.0.2) lib/action_view/helpers/capture_helper.rb:38:in `block in capture' 
actionpack (4.0.2) lib/action_view/helpers/capture_helper.rb:200:in `with_output_buffer' 
actionpack (4.0.2) lib/action_view/helpers/capture_helper.rb:38:in `capture' 
formtastic (2.3.0.rc2) lib/formtastic/helpers/fieldset_wrapper.rb:32:in `field_set_and_list_wrapping' 
/home/bibou/.rvm/gems/ruby-2.0.0-p353/bundler/gems/active_admin-66de2f86ae1d/lib/active_admin/form_builder.rb:142:in `field_set_and_list_wrapping' 
formtastic (2.3.0.rc2) lib/formtastic/helpers/inputs_helper.rb:292:in `inputs' 
/home/bibou/.rvm/gems/ruby-2.0.0-p353/bundler/gems/active_admin-66de2f86ae1d/lib/active_admin/form_builder.rb:20:in `block in inputs' 
/home/bibou/.rvm/gems/ruby-2.0.0-p353/bundler/gems/active_admin-66de2f86ae1d/lib/active_admin/form_builder.rb:151:in `with_new_form_buffer' 
/home/bibou/.rvm/gems/ruby-2.0.0-p353/bundler/gems/active_admin-66de2f86ae1d/lib/active_admin/form_builder.rb:20:in `inputs' 
app/admin/article.rb:10:in `block (2 levels) in <top (required)>' 
/home/bibou/.rvm/gems/ruby-2.0.0-p353/bundler/gems/active_admin-66de2f86ae1d/lib/active_admin/views/pages/form.rb:23:in `instance_exec' 
/home/bibou/.rvm/gems/ruby-2.0.0-p353/bundler/gems/active_admin-66de2f86ae1d/lib/active_admin/views/pages/form.rb:23:in `block in main_content' 
actionpack (4.0.2) lib/action_view/helpers/capture_helper.rb:38:in `block in capture' 
actionpack (4.0.2) lib/action_view/helpers/capture_helper.rb:200:in `with_output_buffer' 
actionpack (4.0.2) lib/action_view/helpers/capture_helper.rb:38:in `capture' 
actionpack (4.0.2) lib/action_view/helpers/form_helper.rb:435:in `form_for' 
formtastic (2.3.0.rc2) lib/formtastic/helpers/form_helper.rb:167:in `block in semantic_form_for' 
formtastic (2.3.0.rc2) lib/formtastic/helpers/form_helper.rb:190:in `with_custom_field_error_proc' 
formtastic (2.3.0.rc2) lib/formtastic/helpers/form_helper.rb:166:in `semantic_form_for' 
/home/bibou/.rvm/gems/ruby-2.0.0-p353/bundler/gems/active_admin-66de2f86ae1d/lib/active_admin/view_helpers/form_helper.rb:9:in `active_admin_form_for' 
arbre (1.0.1) lib/arbre/element.rb:175:in `method_missing' 
/home/bibou/.rvm/gems/ruby-2.0.0-p353/bundler/gems/active_admin-66de2f86ae1d/lib/active_admin/views/pages/form.rb:22:in `main_content' 
/home/bibou/.rvm/gems/ruby-2.0.0-p353/bundler/gems/active_admin-66de2f86ae1d/lib/active_admin/views/pages/base.rb:83:in `block (2 levels) in build_main_content_wrapper' 
arbre (1.0.1) lib/arbre/element/builder_methods.rb:31:in `block in build_tag' 
arbre (1.0.1) lib/arbre/context.rb:92:in `with_current_arbre_element' 
arbre (1.0.1) lib/arbre/element/builder_methods.rb:49:in `with_current_arbre_element' 
arbre (1.0.1) lib/arbre/element/builder_methods.rb:26:in `build_tag' 
arbre (1.0.1) lib/arbre/element/builder_methods.rb:39:in `insert_tag' 
arbre (1.0.1) lib/arbre/element/builder_methods.rb:14:in `div' 
/home/bibou/.rvm/gems/ruby-2.0.0-p353/bundler/gems/active_admin-66de2f86ae1d/lib/active_admin/views/pages/base.rb:82:in `block in build_main_content_wrapper' 
arbre (1.0.1) lib/arbre/element/builder_methods.rb:31:in `block in build_tag' 
arbre (1.0.1) lib/arbre/context.rb:92:in `with_current_arbre_element' 
arbre (1.0.1) lib/arbre/element/builder_methods.rb:49:in `with_current_arbre_element' 
arbre (1.0.1) lib/arbre/element/builder_methods.rb:26:in `build_tag' 
arbre (1.0.1) lib/arbre/element/builder_methods.rb:39:in `insert_tag' 
arbre (1.0.1) lib/arbre/element/builder_methods.rb:14:in `div' 
/home/bibou/.rvm/gems/ruby-2.0.0-p353/bundler/gems/active_admin-66de2f86ae1d/lib/active_admin/views/pages/base.rb:81:in `build_main_content_wrapper' 
/home/bibou/.rvm/gems/ruby-2.0.0-p353/bundler/gems/active_admin-66de2f86ae1d/lib/active_admin/views/pages/base.rb:65:in `block in build_page_content' 
arbre (1.0.1) lib/arbre/element/builder_methods.rb:31:in `block in build_tag' 
arbre (1.0.1) lib/arbre/context.rb:92:in `with_current_arbre_element' 
arbre (1.0.1) lib/arbre/element/builder_methods.rb:49:in `with_current_arbre_element' 
arbre (1.0.1) lib/arbre/element/builder_methods.rb:26:in `build_tag' 
arbre (1.0.1) lib/arbre/element/builder_methods.rb:39:in `insert_tag' 
arbre (1.0.1) lib/arbre/element/builder_methods.rb:14:in `div' 
/home/bibou/.rvm/gems/ruby-2.0.0-p353/bundler/gems/active_admin-66de2f86ae1d/lib/active_admin/views/pages/base.rb:64:in `build_page_content' 
/home/bibou/.rvm/gems/ruby-2.0.0-p353/bundler/gems/active_admin-66de2f86ae1d/lib/active_admin/views/pages/base.rb:47:in `block (2 levels) in build_page' 
arbre (1.0.1) lib/arbre/element/builder_methods.rb:31:in `block in build_tag' 
arbre (1.0.1) lib/arbre/context.rb:92:in `with_current_arbre_element' 
arbre (1.0.1) lib/arbre/element/builder_methods.rb:49:in `with_current_arbre_element' 
arbre (1.0.1) lib/arbre/element/builder_methods.rb:26:in `build_tag' 
arbre (1.0.1) lib/arbre/element/builder_methods.rb:39:in `insert_tag' 
arbre (1.0.1) lib/arbre/element/builder_methods.rb:14:in `div' 
/home/bibou/.rvm/gems/ruby-2.0.0-p353/bundler/gems/active_admin-66de2f86ae1d/lib/active_admin/views/pages/base.rb:44:in `block in build_page' 
arbre (1.0.1) lib/arbre/context.rb:92:in `with_current_arbre_element' 
arbre (1.0.1) lib/arbre/element/builder_methods.rb:49:in `with_current_arbre_element' 
/home/bibou/.rvm/gems/ruby-2.0.0-p353/bundler/gems/active_admin-66de2f86ae1d/lib/active_admin/views/pages/base.rb:43:in `build_page' 
/home/bibou/.rvm/gems/ruby-2.0.0-p353/bundler/gems/active_admin-66de2f86ae1d/lib/active_admin/views/pages/base.rb:10:in `build' 
arbre (1.0.1) lib/arbre/element/builder_methods.rb:30:in `block in build_tag' 
arbre (1.0.1) lib/arbre/context.rb:92:in `with_current_arbre_element' 
arbre (1.0.1) lib/arbre/element/builder_methods.rb:26:in `build_tag' 
arbre (1.0.1) lib/arbre/element/builder_methods.rb:39:in `insert_tag' 
/home/bibou/.rvm/gems/ruby-2.0.0-p353/bundler/gems/active_admin-66de2f86ae1d/app/views/active_admin/resource/new.html.arb:1:in `block in __home_bibou__rvm_gems_ruby_______p____bundler_gems_active_admin___de_f__ae_d_app_views_active_admin_resource_new_html_arb__2699006568721876069_69819426589980' 
arbre (1.0.1) lib/arbre/context.rb:45:in `instance_eval' 
arbre (1.0.1) lib/arbre/context.rb:45:in `initialize' 
/home/bibou/.rvm/gems/ruby-2.0.0-p353/bundler/gems/active_admin-66de2f86ae1d/app/views/active_admin/resource/new.html.arb:1:in `new' 
/home/bibou/.rvm/gems/ruby-2.0.0-p353/bundler/gems/active_admin-66de2f86ae1d/app/views/active_admin/resource/new.html.arb:1:in `__home_bibou__rvm_gems_ruby_______p____bundler_gems_active_admin___de_f__ae_d_app_views_active_admin_resource_new_html_arb__2699006568721876069_69819426589980' 
actionpack (4.0.2) lib/action_view/template.rb:143:in `block in render' 
activesupport (4.0.2) lib/active_support/notifications.rb:161:in `instrument' 
actionpack (4.0.2) lib/action_view/template.rb:141:in `render' 
actionpack (4.0.2) lib/action_view/renderer/template_renderer.rb:49:in `block (2 levels) in render_template' 
actionpack (4.0.2) lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument' 
activesupport (4.0.2) lib/active_support/notifications.rb:159:in `block in instrument' 
activesupport (4.0.2) lib/active_support/notifications/instrumenter.rb:20:in `instrument' 
activesupport (4.0.2) lib/active_support/notifications.rb:159:in `instrument' 
actionpack (4.0.2) lib/action_view/renderer/abstract_renderer.rb:38:in `instrument' 
actionpack (4.0.2) lib/action_view/renderer/template_renderer.rb:48:in `block in render_template' 
actionpack (4.0.2) lib/action_view/renderer/template_renderer.rb:56:in `render_with_layout' 
actionpack (4.0.2) lib/action_view/renderer/template_renderer.rb:47:in `render_template' 
actionpack (4.0.2) lib/action_view/renderer/template_renderer.rb:17:in `render' 
actionpack (4.0.2) lib/action_view/renderer/renderer.rb:42:in `render_template' 
actionpack (4.0.2) lib/action_view/renderer/renderer.rb:23:in `render' 
actionpack (4.0.2) lib/abstract_controller/rendering.rb:127:in `_render_template' 
actionpack (4.0.2) lib/action_controller/metal/streaming.rb:219:in `_render_template' 
actionpack (4.0.2) lib/abstract_controller/rendering.rb:120:in `render_to_body' 
actionpack (4.0.2) lib/action_controller/metal/rendering.rb:33:in `render_to_body' 
actionpack (4.0.2) lib/action_controller/metal/renderers.rb:26:in `render_to_body' 
actionpack (4.0.2) lib/abstract_controller/rendering.rb:97:in `render' 
actionpack (4.0.2) lib/action_controller/metal/rendering.rb:16:in `render' 
actionpack (4.0.2) lib/action_controller/metal/instrumentation.rb:41:in `block (2 levels) in render' 
activesupport (4.0.2) lib/active_support/core_ext/benchmark.rb:12:in `block in ms' 
/home/bibou/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/benchmark.rb:296:in `realtime' 
activesupport (4.0.2) lib/active_support/core_ext/benchmark.rb:12:in `ms' 
actionpack (4.0.2) lib/action_controller/metal/instrumentation.rb:41:in `block in render' 
actionpack (4.0.2) lib/action_controller/metal/instrumentation.rb:84:in `cleanup_view_runtime' 
activerecord (4.0.2) lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime' 
actionpack (4.0.2) lib/action_controller/metal/instrumentation.rb:40:in `render' 
actionpack (4.0.2) lib/action_controller/metal/implicit_render.rb:10:in `default_render' 
actionpack (4.0.2) lib/action_controller/metal/responder.rb:233:in `default_render' 
actionpack (4.0.2) lib/action_controller/metal/responder.rb:161:in `to_html' 
responders (1.0.0) lib/responders/flash_responder.rb:104:in `to_html' 
actionpack (4.0.2) lib/action_controller/metal/responder.rb:154:in `respond' 
actionpack (4.0.2) lib/action_controller/metal/responder.rb:147:in `call' 
actionpack (4.0.2) lib/action_controller/metal/mime_responds.rb:330:in `respond_with' 
inherited_resources (1.4.1) lib/inherited_resources/actions.rb:19:in `new' 
actionpack (4.0.2) lib/action_controller/metal/implicit_render.rb:4:in `send_action' 
actionpack (4.0.2) lib/abstract_controller/base.rb:189:in `process_action' 
actionpack (4.0.2) lib/action_controller/metal/rendering.rb:10:in `process_action' 
actionpack (4.0.2) lib/abstract_controller/callbacks.rb:18:in `block in process_action' 
activesupport (4.0.2) lib/active_support/callbacks.rb:433:in `_run__2406119207582674973__process_action__callbacks' 
activesupport (4.0.2) lib/active_support/callbacks.rb:80:in `run_callbacks' 
actionpack (4.0.2) lib/abstract_controller/callbacks.rb:17:in `process_action' 
actionpack (4.0.2) lib/action_controller/metal/rescue.rb:29:in `process_action' 
actionpack (4.0.2) lib/action_controller/metal/instrumentation.rb:31:in `block in process_action' 
activesupport (4.0.2) lib/active_support/notifications.rb:159:in `block in instrument' 
activesupport (4.0.2) lib/active_support/notifications/instrumenter.rb:20:in `instrument' 
activesupport (4.0.2) lib/active_support/notifications.rb:159:in `instrument' 
actionpack (4.0.2) lib/action_controller/metal/instrumentation.rb:30:in `process_action' 
actionpack (4.0.2) lib/action_controller/metal/params_wrapper.rb:245:in `process_action' 
activerecord (4.0.2) lib/active_record/railties/controller_runtime.rb:18:in `process_action' 
actionpack (4.0.2) lib/abstract_controller/base.rb:136:in `process' 
actionpack (4.0.2) lib/abstract_controller/rendering.rb:44:in `process' 
actionpack (4.0.2) lib/action_controller/metal.rb:195:in `dispatch' 
actionpack (4.0.2) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch' 
actionpack (4.0.2) lib/action_controller/metal.rb:231:in `block in action' 
actionpack (4.0.2) lib/action_dispatch/routing/route_set.rb:80:in `call' 
actionpack (4.0.2) lib/action_dispatch/routing/route_set.rb:80:in `dispatch' 
actionpack (4.0.2) lib/action_dispatch/routing/route_set.rb:48:in `call' 
actionpack (4.0.2) lib/action_dispatch/journey/router.rb:71:in `block in call' 
actionpack (4.0.2) lib/action_dispatch/journey/router.rb:59:in `each' 
actionpack (4.0.2) lib/action_dispatch/journey/router.rb:59:in `call' 
actionpack (4.0.2) lib/action_dispatch/routing/route_set.rb:680:in `call' 
warden (1.2.3) lib/warden/manager.rb:35:in `block in call' 
warden (1.2.3) lib/warden/manager.rb:34:in `catch' 
warden (1.2.3) lib/warden/manager.rb:34:in `call' 
rack (1.5.2) lib/rack/etag.rb:23:in `call' 
rack (1.5.2) lib/rack/conditionalget.rb:25:in `call' 
rack (1.5.2) lib/rack/head.rb:11:in `call' 
actionpack (4.0.2) lib/action_dispatch/middleware/params_parser.rb:27:in `call' 
actionpack (4.0.2) lib/action_dispatch/middleware/flash.rb:241:in `call' 
rack (1.5.2) lib/rack/session/abstract/id.rb:225:in `context' 
rack (1.5.2) lib/rack/session/abstract/id.rb:220:in `call' 
actionpack (4.0.2) lib/action_dispatch/middleware/cookies.rb:486:in `call' 
activerecord (4.0.2) lib/active_record/query_cache.rb:36:in `call' 
activerecord (4.0.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:626:in `call' 
activerecord (4.0.2) lib/active_record/migration.rb:369:in `call' 
actionpack (4.0.2) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call' 
activesupport (4.0.2) lib/active_support/callbacks.rb:373:in `_run__1775309793310121907__call__callbacks' 
activesupport (4.0.2) lib/active_support/callbacks.rb:80:in `run_callbacks' 
actionpack (4.0.2) lib/action_dispatch/middleware/callbacks.rb:27:in `call' 
actionpack (4.0.2) lib/action_dispatch/middleware/reloader.rb:64:in `call' 
actionpack (4.0.2) lib/action_dispatch/middleware/remote_ip.rb:76:in `call' 
actionpack (4.0.2) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call' 
actionpack (4.0.2) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call' 
railties (4.0.2) lib/rails/rack/logger.rb:38:in `call_app' 
railties (4.0.2) lib/rails/rack/logger.rb:20:in `block in call' 
activesupport (4.0.2) lib/active_support/tagged_logging.rb:67:in `block in tagged' 
activesupport (4.0.2) lib/active_support/tagged_logging.rb:25:in `tagged' 
activesupport (4.0.2) lib/active_support/tagged_logging.rb:67:in `tagged' 
railties (4.0.2) lib/rails/rack/logger.rb:20:in `call' 
actionpack (4.0.2) lib/action_dispatch/middleware/request_id.rb:21:in `call' 
rack (1.5.2) lib/rack/methodoverride.rb:21:in `call' 
rack (1.5.2) lib/rack/runtime.rb:17:in `call' 
activesupport (4.0.2) lib/active_support/cache/strategy/local_cache.rb:83:in `call' 
rack (1.5.2) lib/rack/lock.rb:17:in `call' 
actionpack (4.0.2) lib/action_dispatch/middleware/static.rb:64:in `call' 
rack (1.5.2) lib/rack/sendfile.rb:112:in `call' 
railties (4.0.2) lib/rails/engine.rb:511:in `call' 
railties (4.0.2) lib/rails/application.rb:97:in `call' 
rack (1.5.2) lib/rack/lock.rb:17:in `call' 
rack (1.5.2) lib/rack/content_length.rb:14:in `call' 
rack (1.5.2) lib/rack/handler/webrick.rb:60:in `service' 
/home/bibou/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service' 
/home/bibou/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run' 
/home/bibou/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread' 

謝謝您的幫助

編輯:

我用這種寶石爲我的項目:

gem 'devise' 
gem 'cancan' 
gem 'activeadmin', github: 'gregbell/active_admin' 
gem 'annotate' 
gem 'ckeditor' 
gem "paperclip", "~> 4.1" 

我的操作系統是Ubuntu的我使用ImageMagick-6.8.8-7。

當我運行which convert 我:/usr/local/bin/convert

development.rb

PaperclipActiveadmin::Application.configure do 
    # Settings specified here will take precedence over those in config/application.rb. 

    # In the development environment your application's code is reloaded on 
    # every request. This slows down response time but is perfect for development 
    # since you don't have to restart the web server when you make code changes. 
    config.cache_classes = false 

    # Do not eager load code on boot. 
    config.eager_load = false 

    # Show full error reports and disable caching. 
    config.consider_all_requests_local  = true 
    config.action_controller.perform_caching = false 

    # Don't care if the mailer can't send. 
    config.action_mailer.raise_delivery_errors = false 

    # Print deprecation notices to the Rails logger. 
    config.active_support.deprecation = :log 

    # Raise an error on page load if there are pending migrations 
    config.active_record.migration_error = :page_load 

    # Debug mode disables concatenation and preprocessing of assets. 
    # This option may cause significant delays in view rendering with a large 
    # number of complex assets. 
    config.assets.debug = true 

    # configure paperclip 
    Paperclip.options[:command_path] = "/usr/local/bin/" 

end 

解決方案:

添加require: false我輸入:

p.input :picture, :as => :file, :hint => p.object.new_record? ? "" : f.template.image_tag(p.object.picture.url(:thumb)), required: false 

而且在我的形象.rb添加一個validates_attachment_content_type

validates_attachment_content_type :picture, :content_type => ["image/jpg", "image/jpeg", "image/png"] 

感謝菲利普Hallstrom的爲您的幫助和解決方案

+0

首先,請爲您的縮進使用統一的空格。您同時使用4個和2個空格,有時在同一個文件中。 Ruby社區建議使用2個空格。你確定你已經安裝了所有的寶石(回形針需要ImageMagick,一個外部程序)。另外,你在什麼操作系統?我認爲應該有更多的痕跡。 –

+0

我已經用2個空格表示編輯了我的帖子。我的操作系統是Ubuntu,我的ImageMagick版本是v6.8.8-7。 – Bibou

+0

沒有解決方案,但我也現在遇到此錯誤。 –

回答