Rails Paperclip Gem Fehler bei der Anzahl der Argumente

Ich arbeite an meinem ersten RoR-Projekt und versuche, das Paperclip-Juwel zu verwenden, aber ich stoße auf einen Fehler, den ich nicht herauszufinden scheint:

falsche Anzahl von Argumenten (1 für 0)
app / controller / events_controller.rb: 43: in `create '
Parameter:

{"utf8"=>"✓",
 "authenticity_token"=>"OBYHA0M+TA93sNF3uqrJ/zvnnEyWJUREn4NcOl0ExfA=",
 "event"=>{"title"=>"",
 "image"=>#<ActionDispatch::Http::UploadedFile:0x007f803802b1f0 @original_filename="icon.png",
 @content_type="image/png",
 @headers="Content-Disposition: form-data; name=\"event[image]\"; filename=\"icon.png\"\r\nContent-Type: image/png\r\n",
 @tempfile=#<File:/tmp/RackMultipart20130217-21480-1molvwa>>,
 "description"=>"",
 "date"=>"",
 "time"=>""},
 "commit"=>"Create Event"}

Ich verstehe, dass in events_controller.rb in der create-Methode zu viele Argumente übergeben werden. Ich habe jedoch die QuickStart-Anweisungen auf Paperclip's Github befolgt, sodass ich nicht sicher bin, warum ich diesen Fehler erhalte.

Hier ist mein Code für events_controller.rb

def create
    @event = Event.create( params[:event] )
 end

Nur zum Debuggen habe ich versucht, die Zeile in Event.create (params []) zu ändern. Zu diesem Zeitpunkt wurde der Fehler von einer falschen Anzahl von Argumenten (1 für 0) in eine falsche Anzahl von Argumenten (0 für 1) geändert.

Hier ist mein Code für event.rb

class Event < ActiveRecord::Base
    attr_accessible :date, :description, :time, :title, :image
    has_attached_file :image, :styles => { :medium => "300x300>", :thumb => "100x100>" }
end

Ich habe überprüft, ob für alles die richtigen Versionen ausgeführt werden. Ich habe Paperclip 3.4.0, Rails 3.2.12, Ruby 1.9.3 und ImageMagick 6.8.3-1. Ich benutze Ubuntu 12.04 LTS.

Ich habe mir einige ähnliche Probleme angesehen, aber die meisten schienen vor einigen Jahren aufzutreten und wurden in nachfolgenden Updates von Paperclip behoben. Keine der Lösungen, die ich in ähnlichen Beiträgen gefunden habe, hat für mich funktioniert, und leider habe ich noch nicht genug Rails-Erfahrung, um zu wissen, was los ist. Mir ist klar, dass ich wahrscheinlich einen absoluten Anfängerfehler mache. In diesem Fall entschuldige ich mich, würde mich aber trotzdem über eine Hilfe freuen, um mich auf den richtigen Weg zu bringen.

Bitte lassen Sie mich wissen, ob zusätzlicher Code oder zusätzliche Informationen für das Debuggen hilfreich sind.

Vielen Dank für Ihre Zeit!

Anwendungsablaufverfolgung:

cocaine (0.3.2) lib / cocaine / command_line.rb: 63: inrun' /home/user/.rvm/gems/ruby-1.9.3-p385/bundler/gems/paperclip-dcd2774e7913/lib/paperclip/helpers.rb:31:inFühren Sie "/home/user/.rvm/gems/ruby-1.9.3-p385/bundler/gems/paperclip-dcd2774e7913/lib/paperclip/geometry_detector_factory.rb:18:in" ausblock in geometry_string' activesupport (3.2.12) lib/active_support/core_ext/kernel/reporting.rb:43:insilence_stream '/home/user/.rvm/gems/ruby-1.9.3-p385/bundler/gems/paperclip-dcd2774e7913/lib/paperclip/geometry_detector_factory.rb:17:ingeometry_string' /home/user/.rvm/gems/ruby-1.9.3-p385/bundler/gems/paperclip-dcd2774e7913/lib/paperclip/geometry_detector_factory.rb:9:inMachen Sie '/home/user/.rvm/gems/ruby-1.9.3-p385/bundler/gems/paperclip-dcd2774e7913/lib/paperclip/geometry.rb:26:infrom_file' /home/user/.rvm/gems/ruby-1.9.3-p385/bundler/gems/paperclip-dcd2774e7913/lib/paperclip/thumbnail.rb:35:inInitialisieren Sie '/home/user/.rvm/gems/ruby-1.9.3-p385/bundler/gems/paperclip-dcd2774e7913/lib/paperclip/processor.rb:33:innew' /home/user/.rvm/gems/ruby-1.9.3-p385/bundler/gems/paperclip-dcd2774e7913/lib/paperclip/processor.rb:33:inMachen Sie '/home/user/.rvm/gems/ruby-1.9.3-p385/bundler/gems/paperclip-dcd2774e7913/lib/paperclip/attachment.rb:431:inblock in post_process_style' /home/user/.rvm/gems/ruby-1.9.3-p385/bundler/gems/paperclip-dcd2774e7913/lib/paperclip/attachment.rb:430:ineach '/home/user/.rvm/gems/ruby-1.9.3-p385/bundler/gems/paperclip-dcd2774e7913/lib/paperclip/attachment.rb:430:ininject' /home/user/.rvm/gems/ruby-1.9.3-p385/bundler/gems/paperclip-dcd2774e7913/lib/paperclip/attachment.rb:430:inpost_process_style '/home/user/.rvm/gems/ruby-1.9.3-p385/bundler/gems/paperclip-dcd2774e7913/lib/paperclip/attachment.rb:423:inblock in post_process_styles' /home/user/.rvm/gems/ruby-1.9.3-p385/bundler/gems/paperclip-dcd2774e7913/lib/paperclip/attachment.rb:422:ineach '/home/user/.rvm/gems/ruby-1.9.3-p385/bundler/gems/paperclip-dcd2774e7913/lib/paperclip/attachment.rb:422:inpost_process_styles' /home/user/.rvm/gems/ruby-1.9.3-p385/bundler/gems/paperclip-dcd2774e7913/lib/paperclip/attachment.rb:415:inBlock (2 Ebenen) in der aktiven Unterstützung von post_process (3.2.12) lib / active_support / callbacks.rb: 403: in_run__3384881169595487878__image_post_process__96086910066492375__callbacks' activesupport (3.2.12) lib/active_support/callbacks.rb:405:in__run_callback 'activesupport (3.2.12) lib / active_support / callbacks.rb: 385: in_run_image_post_process_callbacks' activesupport (3.2.12) lib/active_support/callbacks.rb:81:inrun_callbacks '/home/user/.rvm/gems/ruby-1.9.3-p385/bundler/gems/paperclip-dcd2774e7913/lib/paperclip/callbacks.rb:26:inrun_paperclip_callbacks' /home/user/.rvm/gems/ruby-1.9.3-p385/bundler/gems/paperclip-dcd2774e7913/lib/paperclip/attachment.rb:414:inblock in post_process 'activesupport (3.2.12) lib / active_support / callbacks.rb: 403: in_run__3384881169595487878__post_process__96086910066492375__callbacks' activesupport (3.2.12) lib/active_support/callbacks.rb:405:in__run_callback 'activesupport (3.2.12) lib / active_support / callbacks.rb: 385: in_run_post_process_callbacks' activesupport (3.2.12) lib/active_support/callbacks.rb:81:inrun_callbacks '/home/user/.rvm/gems/ruby-1.9.3-p385/bundler/gems/paperclip-dcd2774e7913/lib/paperclip/callbacks.rb:26:inrun_paperclip_callbacks' /home/user/.rvm/gems/ruby-1.9.3-p385/bundler/gems/paperclip-dcd2774e7913/lib/paperclip/attachment.rb:413:inpost_process '/home/user/.rvm/gems/ruby-1.9.3-p385/bundler/gems/paperclip-dcd2774e7913/lib/paperclip/attachment.rb:108:inassign' /home/user/.rvm/gems/ruby-1.9.3-p385/bundler/gems/paperclip-dcd2774e7913/lib/paperclip.rb:200:inblock in has_attached_file 'activerecord (3.2.12) lib / active_record / attribute_assignment.rb: 85: inblock in assign_attributes' activerecord (3.2.12) lib/active_record/attribute_assignment.rb:78:injeder 'activerecord (3.2.12) lib / active_record / attribute_assignment.rb: 78: inassign_attributes' activerecord (3.2.12) lib/active_record/base.rb:497:ininitialize 'activerecord (3.2.12) lib / active_record / persistence.rb: 44: innew' activerecord (3.2.12) lib/active_record/persistence.rb:44:inErstelle 'app / controller / events_controller.rb: 43: increate' actionpack (3.2.12) lib/action_controller/metal/implicit_render.rb:4:insend_action 'actionpack (3.2.12) lib / abstract_controller / base.rb: 167: inprocess_action' actionpack (3.2.12) lib/action_controller/metal/rendering.rb:10:inprocess_action 'actionpack (3.2.12) lib / abstract_controller / callbacks.rb: 18: inblock in process_action' activesupport (3.2.12) lib/active_support/callbacks.rb:414:inLauf_3332570171411252513__process_action_3320642634939127128_callbacks 'activesupport (3.2.12) lib / active_support / callbacks.rb: 405: in__run_callback' activesupport (3.2.12) lib/active_support/callbacks.rb:385:in_run_process_action_callbacks 'activesupport (3.2.12) lib / active_support / callbacks.rb: 81: inrun_callbacks' actionpack (3.2.12) lib/abstract_controller/callbacks.rb:17:inprocess_action 'actionpack (3.2.12) lib / action_controller / metal / rescue.rb: 29: inprocess_action' actionpack (3.2.12) lib/action_controller/metal/instrumentation.rb:30:inblock in process_action 'activesupport (3.2.12) lib / active_support / notifications.rb: 123: inblock in instrument' activesupport (3.2.12) lib/active_support/notifications/instrumenter.rb:20:ininstrument 'activesupport (3.2.12) lib / active_support / notifications.rb: 123: ininstrument' actionpack (3.2.12) lib/action_controller/metal/instrumentation.rb:29:inprocess_action 'actionpack (3.2.12) lib / action_controller / metal / params_wrapper.rb: 207: inprocess_action' activerecord (3.2.12) lib/active_record/railties/controller_runtime.rb:18:inprocess_action 'actionpack (3.2.12) lib / abstract_controller / base.rb: 121: inprocess' actionpack (3.2.12) lib/abstract_controller/rendering.rb:45:inprocess 'actionpack (3.2.12) lib / action_controller / metal.rb: 203: indispatch' actionpack (3.2.12) lib/action_controller/metal/rack_delegation.rb:14:indispatch 'actionpack (3.2.12) lib / action_controller / metal.rb: 246: inblock in action' actionpack (3.2.12) lib/action_dispatch/routing/route_set.rb:73:inRufen Sie 'actionpack (3.2.12) lib / action_dispatch / routing / route_set.rb: 73: in aufdispatch' actionpack (3.2.12) lib/action_dispatch/routing/route_set.rb:36:incall 'journey (1.0.4) lib / journey / router.rb: 68: inblock in call' journey (1.0.4) lib/journey/router.rb:56:inevery 'journey (1.0.4) lib / journey / router.rb: 56: incall' actionpack (3.2.12) lib/action_dispatch/routing/route_set.rb:601:inRufen Sie 'actionpack (3.2.12) lib / action_dispatch / middleware / best_standards_support.rb: 17: in aufcall' rack (1.4.5) lib/rack/etag.rb:23:inRufen Sie 'rack (1.4.5) lib / rack / conditionalget.rb: 35: in aufcall' actionpack (3.2.12) lib/action_dispatch/middleware/head.rb:14:inRufen Sie 'actionpack (3.2.12) lib / action_dispatch / middleware / params_parser.rb: 21: in aufcall' actionpack (3.2.12) lib/action_dispatch/middleware/flash.rb:242:inRufen Sie 'rack (1.4.5) lib / rack / session / abstract / id.rb: 210: in aufcontext' rack (1.4.5) lib/rack/session/abstract/id.rb:205:inRufen Sie 'actionpack (3.2.12) lib / action_dispatch / middleware / cookies.rb: 341: in aufcall' activerecord (3.2.12) lib/active_record/query_cache.rb:64:inRufen Sie 'activerecord (3.2.12) lib / active_record / connection_adapters / abstract / connection_pool.rb: 479: in aufcall' actionpack (3.2.12) lib/action_dispatch/middleware/callbacks.rb:28:inblock in call 'activesupport (3.2.12) lib / active_support / callbacks.rb: 405: in_run__1281245379307539657__call__96086910066492375__callbacks' activesupport (3.2.12) lib/active_support/callbacks.rb:405:in__run_callback 'activesupport (3.2.12) lib / active_support / callbacks.rb: 385: in_run_call_callbacks' activesupport (3.2.12) lib/active_support/callbacks.rb:81:inActionpack von run_callbacks (3.2.12) lib / action_dispatch / middleware / callbacks.rb: 27: incall' actionpack (3.2.12) lib/action_dispatch/middleware/reloader.rb:65:inRufen Sie 'actionpack (3.2.12) lib / action_dispatch / middleware / remote_ip.rb: 31: in aufcall' actionpack (3.2.12) lib/action_dispatch/middleware/debug_exceptions.rb:16:inRufen Sie 'actionpack (3.2.12) lib / action_dispatch / middleware / show_exceptions.rb: 56: in aufcall' railties (3.2.12) lib/rails/rack/logger.rb:32:incall_app 'railties (3.2.12) lib / rails / rack / logger.rb: 16: inblock in call' activesupport (3.2.12) lib/active_support/tagged_logging.rb:22:intagged 'railties (3.2.12) lib / rails / rack / logger.rb: 16: incall' actionpack (3.2.12) lib/action_dispatch/middleware/request_id.rb:22:inRufen Sie 'rack (1.4.5) lib / rack / methodoverride.rb: 21: in aufcall' rack (1.4.5) lib/rack/runtime.rb:17:inRufen Sie 'activesupport (3.2.12) lib / active_support / cache / strategy / local_cache.rb: 72: in aufcall' rack (1.4.5) lib/rack/lock.rb:15:inRufen Sie 'actionpack (3.2.12) lib / action_dispatch / middleware / static.rb: 62: in aufcall' railties (3.2.12) lib/rails/engine.rb:479:incall 'railties (3.2.12) lib / rails / application.rb: 223: incall' rack (1.4.5) lib/rack/content_length.rb:14:inRufen Sie 'railties (3.2.12) lib / rails / rack / log_tailer.rb: 17: in aufcall' rack (1.4.5) lib/rack/handler/webrick.rb:59:inservice '/home/user/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/webrick/httpserver.rb:138:inservice' /home/user/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/webrick/httpserver.rb:94:instarte '/home/user/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'

Antworten auf die Frage(1)

Ihre Antwort auf die Frage