ファイルをアップロードしようとしたときにArgumentError Exception:wrong議論の数(与えられた2、期待される1)ArgumentError Exception:間違った引数の数(指定した2、予想される1)画像をアップロードしようとしたとき(レール4;クリップ5;クリップクリップのメタ)
すべてが正常に動作する前に。私は更新後この動作に気づいたpaperclip
バージョン5.0.0
に
ここに私のコードです。
モデル/ image.rb
class Image < ActiveRecord::Base
belongs_to :imageable, polymorphic: true
has_attached_file :attachment, styles: {
main_large: "628x329>", main_small: "628x329>",
object_large: "1200x1200>", object_small: "177x120",
catalog: "397x312>", thumb: "100x100>"
}, default_url: "/images/:style/missing.png"
validates_attachment :attachment, content_type: { content_type: /\Aimage\/.*\Z/ },
size: { in: 0..10.megabytes }
end
モデル/ estate.rb
class Estate < ActiveRecord::Base
has_many :images, as: :imageable, dependent: :destroy, autosave: true
accepts_nested_attributes_for :images, reject_if: :reject_images, allow_destroy: true
private
def reject_images(attributes)
attributes['attachment'].blank?
end
end
コントローラ/ estates_controller.rb
class EstatesController < ApplicationController
before_action :set_estate, only: :update
def update
respond_to do |format|
if @estate.update(estate_params)
if params[:image]
# This is where I get an exception
@image = @estate.images.create(image_params)
end
format.html { redirect_to @estate, notice: t(:estate_updated) }
else
format.html { render :edit }
end
end
end
private
def set_estate
@estate = Estate.find_by_id(params[:id])
end
def estate_attributes
%i[title address]
end
def image_attributes
%i[attachment name]
end
def estate_params
params.require(:estate).permit(*estate_attributes, image_attributes: image_attributes)
end
def image_params
params.require(:image).permit(*image_attributes)
end
end
の農園/ _form.haml
= simple_form_for @estate, :html => { multipart: true} do |f|
= f.input :title
= f.input :address
= f.label :images
= file_field_tag :attachment, type: :file, multiple: true, name: 'image[attachment]'
= f.button :submit, class: 'expand'
image_params値ここ
{"attachment"=>#<ActionDispatch::Http::UploadedFile:0x007fdb1627e518 @tempfile=#<Tempfile:/var/folders/sk/74r24jps5_j1f5q9y_6fd51w0000gn/T/RackMultipart20160908-4298-1isgwun.jpg>, @original_filename="villa_preview4.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"image[attachment]\"; filename=\"villa_preview4.jpg\"\r\nContent-Type: image/jpeg\r\n">}
は私がimage_params
でImage.new
を呼び出そうとすると、私はこれを取得していますバックトレース
/Users/me/.rvm/gems/[email protected]/gems/activerecord-4.2.4/lib/active_record/relation.rb:327:in `update_all'
/Users/me/.rvm/gems/[email protected]/gems/activerecord-4.2.4/lib/active_record/querying.rb:8:in `update_all'
/Users/me/.rvm/gems/[email protected]/gems/paperclip-meta-0.4.3/lib/paperclip-meta/attachment.rb:44:in `post_process_styles_with_meta_data'
/Users/me/.rvm/gems/[email protected]/gems/paperclip-5.0.0/lib/paperclip/attachment.rb:506:in `block (2 levels) in post_process'
/Users/me/.rvm/gems/[email protected]/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:117:in `call'
/Users/me/.rvm/gems/[email protected]/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
/Users/me/.rvm/gems/[email protected]/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:505:in `call'
/Users/me/.rvm/gems/[email protected]/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:92:in `__run_callbacks__'
/Users/me/.rvm/gems/[email protected]/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:778:in `_run_attachment_post_process_callbacks'
/Users/me/.rvm/gems/[email protected]/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:81:in `run_callbacks'
/Users/me/.rvm/gems/[email protected]/gems/paperclip-5.0.0/lib/paperclip/callbacks.rb:38:in `run_paperclip_callbacks'
/Users/me/.rvm/gems/[email protected]/gems/paperclip-5.0.0/lib/paperclip/attachment.rb:504:in `block in post_process'
/Users/me/.rvm/gems/[email protected]/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:88:in `__run_callbacks__'
/Users/me/.rvm/gems/[email protected]/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:778:in `_run_post_process_callbacks'
/Users/me/.rvm/gems/[email protected]/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:81:in `run_callbacks'
/Users/me/.rvm/gems/[email protected]/gems/paperclip-5.0.0/lib/paperclip/callbacks.rb:38:in `run_paperclip_callbacks'
/Users/me/.rvm/gems/[email protected]/gems/paperclip-5.0.0/lib/paperclip/attachment.rb:503:in `post_process'
/Users/me/.rvm/gems/[email protected]/gems/paperclip-5.0.0/lib/paperclip/attachment.rb:459:in `post_process_file'
/Users/me/.rvm/gems/[email protected]/gems/paperclip-5.0.0/lib/paperclip/attachment.rb:111:in `assign'
/Users/me/.rvm/gems/[email protected]/gems/paperclip-5.0.0/lib/paperclip/has_attached_file.rb:66:in `block in define_setter'
/Users/me/.rvm/gems/[email protected]/gems/activerecord-4.2.4/lib/active_record/attribute_assignment.rb:54:in `public_send'
/Users/me/.rvm/gems/[email protected]/gems/activerecord-4.2.4/lib/active_record/attribute_assignment.rb:54:in `_assign_attribute'
/Users/me/.rvm/gems/[email protected]/gems/activerecord-4.2.4/lib/active_record/attribute_assignment.rb:41:in `block in assign_attributes'
/Users/me/.rvm/gems/[email protected]/gems/actionpack-4.2.4/lib/action_controller/metal/strong_parameters.rb:185:in `each_pair'
/Users/me/.rvm/gems/[email protected]/gems/actionpack-4.2.4/lib/action_controller/metal/strong_parameters.rb:185:in `each_pair'
/Users/me/.rvm/gems/[email protected]/gems/activerecord-4.2.4/lib/active_record/attribute_assignment.rb:35:in `assign_attributes'
/Users/me/.rvm/gems/[email protected]/gems/activerecord-4.2.4/lib/active_record/core.rb:564:in `init_attributes'
/Users/me/.rvm/gems/[email protected]/gems/activerecord-4.2.4/lib/active_record/core.rb:281:in `initialize'
/Users/me/.rvm/gems/[email protected]/gems/activerecord-4.2.4/lib/active_record/inheritance.rb:61:in `new'
/Users/me/.rvm/gems/[email protected]/gems/activerecord-4.2.4/lib/active_record/inheritance.rb:61:in `new'
/Users/me/.rvm/gems/[email protected]/gems/activerecord-4.2.4/lib/active_record/reflection.rb:131:in `build_association'
/Users/me/.rvm/gems/[email protected]/gems/activerecord-4.2.4/lib/active_record/associations/association.rb:250:in `build_record'
/Users/me/.rvm/gems/[email protected]/gems/activerecord-4.2.4/lib/active_record/associations/collection_association.rb:493:in `block in _create_record'
/Users/me/.rvm/gems/[email protected]/gems/activerecord-4.2.4/lib/active_record/associations/collection_association.rb:183:in `block in transaction'
/Users/me/.rvm/gems/[email protected]/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/Users/me/.rvm/gems/[email protected]/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
/Users/me/.rvm/gems/[email protected]/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/Users/me/.rvm/gems/[email protected]/gems/activerecord-4.2.4/lib/active_record/transactions.rb:220:in `transaction'
/Users/me/.rvm/gems/[email protected]/gems/activerecord-4.2.4/lib/active_record/associations/collection_association.rb:182:in `transaction'
/Users/me/.rvm/gems/[email protected]/gems/activerecord-4.2.4/lib/active_record/associations/collection_association.rb:492:in `_create_record'
/Users/me/.rvm/gems/[email protected]/gems/activerecord-4.2.4/lib/active_record/associations/has_many_association.rb:187:in `_create_record'
/Users/me/.rvm/gems/[email protected]/gems/activerecord-4.2.4/lib/active_record/associations/collection_association.rb:153:in `create'
/Users/me/.rvm/gems/[email protected]/gems/activerecord-4.2.4/lib/active_record/associations/collection_proxy.rb:290:in `create'
/Users/me/development/insidevilla/app/controllers/estates_controller.rb:101:in `block in update'
/Users/me/.rvm/gems/[email protected]/gems/actionpack-4.2.4/lib/action_controller/metal/mime_responds.rb:212:in `respond_to'
/Users/me/development/insidevilla/app/controllers/estates_controller.rb:97:in `update'
/Users/me/.rvm/gems/[email protected]/gems/actionpack-4.2.4/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
/Users/me/.rvm/gems/[email protected]/gems/actionpack-4.2.4/lib/abstract_controller/base.rb:198:in `process_action'
/Users/me/.rvm/gems/[email protected]/gems/actionpack-4.2.4/lib/action_controller/metal/rendering.rb:10:in `process_action'
/Users/me/.rvm/gems/[email protected]/gems/actionpack-4.2.4/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
/Users/me/.rvm/gems/[email protected]/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:117:in `call'
/Users/me/.rvm/gems/[email protected]/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
/Users/me/.rvm/gems/[email protected]/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:505:in `call'
/Users/me/.rvm/gems/[email protected]/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:92:in `__run_callbacks__'
/Users/me/.rvm/gems/[email protected]/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:778:in `_run_process_action_callbacks'
/Users/me/.rvm/gems/[email protected]/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:81:in `run_callbacks'
/Users/me/.rvm/gems/[email protected]/gems/actionpack-4.2.4/lib/abstract_controller/callbacks.rb:19:in `process_action'
/Users/me/.rvm/gems/[email protected]/gems/actionpack-4.2.4/lib/action_controller/metal/rescue.rb:29:in `process_action'
/Users/me/.rvm/gems/[email protected]/gems/actionpack-4.2.4/lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
/Users/me/.rvm/gems/[email protected]/gems/activesupport-4.2.4/lib/active_support/notifications.rb:164:in `block in instrument'
/Users/me/.rvm/gems/[email protected]/gems/activesupport-4.2.4/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/Users/me/.rvm/gems/[email protected]/gems/activesupport-4.2.4/lib/active_support/notifications.rb:164:in `instrument'
/Users/me/.rvm/gems/[email protected]/gems/actionpack-4.2.4/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
/Users/me/.rvm/gems/[email protected]/gems/actionpack-4.2.4/lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
/Users/me/.rvm/gems/[email protected]/gems/activerecord-4.2.4/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
/Users/me/.rvm/gems/[email protected]/gems/actionpack-4.2.4/lib/abstract_controller/base.rb:137:in `process'
/Users/me/.rvm/gems/[email protected]/gems/actionview-4.2.4/lib/action_view/rendering.rb:30:in `process'
/Users/me/.rvm/gems/[email protected]/gems/actionpack-4.2.4/lib/action_controller/metal.rb:196:in `dispatch'
/Users/me/.rvm/gems/[email protected]/gems/actionpack-4.2.4/lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
/Users/me/.rvm/gems/[email protected]/gems/actionpack-4.2.4/lib/action_controller/metal.rb:237:in `block in action'
/Users/me/.rvm/gems/[email protected]/gems/actionpack-4.2.4/lib/action_dispatch/routing/route_set.rb:76:in `dispatch'
/Users/me/.rvm/gems/[email protected]/gems/actionpack-4.2.4/lib/action_dispatch/routing/route_set.rb:45:in `serve'
/Users/me/.rvm/gems/[email protected]/gems/actionpack-4.2.4/lib/action_dispatch/routing/mapper.rb:49:in `serve'
/Users/me/.rvm/gems/[email protected]/gems/actionpack-4.2.4/lib/action_dispatch/journey/router.rb:43:in `block in serve'
/Users/me/.rvm/gems/[email protected]/gems/actionpack-4.2.4/lib/action_dispatch/journey/router.rb:30:in `each'
/Users/me/.rvm/gems/[email protected]/gems/actionpack-4.2.4/lib/action_dispatch/journey/router.rb:30:in `serve'
/Users/me/.rvm/gems/[email protected]/gems/actionpack-4.2.4/lib/action_dispatch/routing/route_set.rb:821:in `call'
/Users/me/.rvm/gems/[email protected]/gems/bullet-5.2.0/lib/bullet/rack.rb:12:in `call'
/Users/me/.rvm/gems/[email protected]/gems/warden-1.2.6/lib/warden/manager.rb:35:in `block in call'
/Users/me/.rvm/gems/[email protected]/gems/warden-1.2.6/lib/warden/manager.rb:34:in `catch'
/Users/me/.rvm/gems/[email protected]/gems/warden-1.2.6/lib/warden/manager.rb:34:in `call'
/Users/me/.rvm/gems/[email protected]/gems/rack-1.6.4/lib/rack/etag.rb:24:in `call'
/Users/me/.rvm/gems/[email protected]/gems/rack-1.6.4/lib/rack/conditionalget.rb:38:in `call'
/Users/me/.rvm/gems/[email protected]/gems/rack-1.6.4/lib/rack/head.rb:13:in `call'
/Users/me/.rvm/gems/[email protected]/gems/actionpack-4.2.4/lib/action_dispatch/middleware/params_parser.rb:27:in `call'
/Users/me/.rvm/gems/[email protected]/gems/actionpack-4.2.4/lib/action_dispatch/middleware/flash.rb:260:in `call'
/Users/me/.rvm/gems/[email protected]/gems/rack-1.6.4/lib/rack/session/abstract/id.rb:225:in `context'
/Users/me/.rvm/gems/[email protected]/gems/rack-1.6.4/lib/rack/session/abstract/id.rb:220:in `call'
/Users/me/.rvm/gems/[email protected]/gems/actionpack-4.2.4/lib/action_dispatch/middleware/cookies.rb:560:in `call'
/Users/me/.rvm/gems/[email protected]/gems/activerecord-4.2.4/lib/active_record/query_cache.rb:36:in `call'
/Users/me/.rvm/gems/[email protected]/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:653:in `call'
/Users/me/.rvm/gems/[email protected]/gems/activerecord-4.2.4/lib/active_record/migration.rb:377:in `call'
/Users/me/.rvm/gems/[email protected]/gems/actionpack-4.2.4/lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
/Users/me/.rvm/gems/[email protected]/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:88:in `__run_callbacks__'
/Users/me/.rvm/gems/[email protected]/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:778:in `_run_call_callbacks'
/Users/me/.rvm/gems/[email protected]/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:81:in `run_callbacks'
/Users/me/.rvm/gems/[email protected]/gems/actionpack-4.2.4/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
/Users/me/.rvm/gems/[email protected]/gems/actionpack-4.2.4/lib/action_dispatch/middleware/reloader.rb:73:in `call'
/Users/me/.rvm/gems/[email protected]/gems/actionpack-4.2.4/lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
/Users/me/.rvm/gems/[email protected]/gems/better_errors-2.1.1/lib/better_errors/middleware.rb:84:in `protected_app_call'
/Users/me/.rvm/gems/[email protected]/gems/better_errors-2.1.1/lib/better_errors/middleware.rb:79:in `better_errors_call'
/Users/me/.rvm/gems/[email protected]/gems/better_errors-2.1.1/lib/better_errors/middleware.rb:57:in `call'
/Users/me/.rvm/gems/[email protected]/gems/actionpack-4.2.4/lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
/Users/me/.rvm/gems/[email protected]/gems/web-console-2.3.0/lib/web_console/middleware.rb:28:in `block in call'
/Users/me/.rvm/gems/[email protected]/gems/web-console-2.3.0/lib/web_console/middleware.rb:18:in `catch'
/Users/me/.rvm/gems/[email protected]/gems/web-console-2.3.0/lib/web_console/middleware.rb:18:in `call'
/Users/me/.rvm/gems/[email protected]/gems/actionpack-4.2.4/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
/Users/me/.rvm/gems/[email protected]/gems/railties-4.2.4/lib/rails/rack/logger.rb:38:in `call_app'
/Users/me/.rvm/gems/[email protected]/gems/railties-4.2.4/lib/rails/rack/logger.rb:20:in `block in call'
/Users/me/.rvm/gems/[email protected]/gems/activesupport-4.2.4/lib/active_support/tagged_logging.rb:68:in `block in tagged'
/Users/me/.rvm/gems/[email protected]/gems/activesupport-4.2.4/lib/active_support/tagged_logging.rb:26:in `tagged'
/Users/me/.rvm/gems/[email protected]/gems/activesupport-4.2.4/lib/active_support/tagged_logging.rb:68:in `tagged'
/Users/me/.rvm/gems/[email protected]/gems/railties-4.2.4/lib/rails/rack/logger.rb:20:in `call'
/Users/me/.rvm/gems/[email protected]/gems/quiet_assets-1.1.0/lib/quiet_assets.rb:27:in `call_with_quiet_assets'
/Users/me/.rvm/gems/[email protected]/gems/request_store-1.3.1/lib/request_store/middleware.rb:9:in `call'
/Users/me/.rvm/gems/[email protected]/gems/actionpack-4.2.4/lib/action_dispatch/middleware/request_id.rb:21:in `call'
/Users/me/.rvm/gems/[email protected]/gems/rack-1.6.4/lib/rack/methodoverride.rb:22:in `call'
/Users/me/.rvm/gems/[email protected]/gems/rack-1.6.4/lib/rack/runtime.rb:18:in `call'
/Users/me/.rvm/gems/[email protected]/gems/rack-1.6.4/lib/rack/lock.rb:17:in `call'
/Users/me/.rvm/gems/[email protected]/gems/actionpack-4.2.4/lib/action_dispatch/middleware/static.rb:116:in `call'
/Users/me/.rvm/gems/[email protected]/gems/rack-1.6.4/lib/rack/sendfile.rb:113:in `call'
/Users/me/.rvm/gems/[email protected]/gems/railties-4.2.4/lib/rails/engine.rb:518:in `call'
/Users/me/.rvm/gems/[email protected]/gems/railties-4.2.4/lib/rails/application.rb:165:in `call'
/Users/me/.rvm/gems/[email protected]/gems/rack-1.6.4/lib/rack/lock.rb:17:in `call'
/Users/me/.rvm/gems/[email protected]/gems/rack-1.6.4/lib/rack/content_length.rb:15:in `call'
/Users/me/.rvm/gems/[email protected]/gems/rack-1.6.4/lib/rack/handler/webrick.rb:88:in `service'
/Users/me/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/webrick/httpserver.rb:140:in `service'
/Users/me/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/webrick/httpserver.rb:96:in `run'
/Users/me/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/webrick/server.rb:296:in `block in start_thread'
です:
Image.new image_params
Command :: file -b --mime '/var/folders/sk/74r24jps5_j1f5q9y_6fd51w0000gn/T/0f78723eb5a6cbbd49eee5d96e457b4220160908-4298-1hzy2cn.jpg'
Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/sk/74r24jps5_j1f5q9y_6fd51w0000gn/T/0f78723eb5a6cbbd49eee5d96e457b4220160908-4298-ujm8kq.jpg[0]' 2>/dev/null
Command :: identify -format %m '/var/folders/sk/74r24jps5_j1f5q9y_6fd51w0000gn/T/0f78723eb5a6cbbd49eee5d96e457b4220160908-4298-ujm8kq.jpg[0]'
Command :: convert '/var/folders/sk/74r24jps5_j1f5q9y_6fd51w0000gn/T/0f78723eb5a6cbbd49eee5d96e457b4220160908-4298-ujm8kq.jpg[0]' -auto-orient -resize "628x329>" '/var/folders/sk/74r24jps5_j1f5q9y_6fd51w0000gn/T/b5e82b87117f82d588c21a40c76ec97c20160908-4298-54awsi'
Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/sk/74r24jps5_j1f5q9y_6fd51w0000gn/T/0f78723eb5a6cbbd49eee5d96e457b4220160908-4298-ujm8kq.jpg[0]' 2>/dev/null
Command :: identify -format %m '/var/folders/sk/74r24jps5_j1f5q9y_6fd51w0000gn/T/0f78723eb5a6cbbd49eee5d96e457b4220160908-4298-ujm8kq.jpg[0]'
Command :: convert '/var/folders/sk/74r24jps5_j1f5q9y_6fd51w0000gn/T/0f78723eb5a6cbbd49eee5d96e457b4220160908-4298-ujm8kq.jpg[0]' -auto-orient -resize "628x329>" '/var/folders/sk/74r24jps5_j1f5q9y_6fd51w0000gn/T/b5e82b87117f82d588c21a40c76ec97c20160908-4298-xoxuv1'
Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/sk/74r24jps5_j1f5q9y_6fd51w0000gn/T/0f78723eb5a6cbbd49eee5d96e457b4220160908-4298-ujm8kq.jpg[0]' 2>/dev/null
Command :: identify -format %m '/var/folders/sk/74r24jps5_j1f5q9y_6fd51w0000gn/T/0f78723eb5a6cbbd49eee5d96e457b4220160908-4298-ujm8kq.jpg[0]'
Command :: convert '/var/folders/sk/74r24jps5_j1f5q9y_6fd51w0000gn/T/0f78723eb5a6cbbd49eee5d96e457b4220160908-4298-ujm8kq.jpg[0]' -auto-orient -resize "1200x1200>" '/var/folders/sk/74r24jps5_j1f5q9y_6fd51w0000gn/T/b5e82b87117f82d588c21a40c76ec97c20160908-4298-113xm2r'
Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/sk/74r24jps5_j1f5q9y_6fd51w0000gn/T/0f78723eb5a6cbbd49eee5d96e457b4220160908-4298-ujm8kq.jpg[0]' 2>/dev/null
Command :: identify -format %m '/var/folders/sk/74r24jps5_j1f5q9y_6fd51w0000gn/T/0f78723eb5a6cbbd49eee5d96e457b4220160908-4298-ujm8kq.jpg[0]'
Command :: convert '/var/folders/sk/74r24jps5_j1f5q9y_6fd51w0000gn/T/0f78723eb5a6cbbd49eee5d96e457b4220160908-4298-ujm8kq.jpg[0]' -auto-orient -resize "177x120" '/var/folders/sk/74r24jps5_j1f5q9y_6fd51w0000gn/T/b5e82b87117f82d588c21a40c76ec97c20160908-4298-1lmis7m'
Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/sk/74r24jps5_j1f5q9y_6fd51w0000gn/T/0f78723eb5a6cbbd49eee5d96e457b4220160908-4298-ujm8kq.jpg[0]' 2>/dev/null
Command :: identify -format %m '/var/folders/sk/74r24jps5_j1f5q9y_6fd51w0000gn/T/0f78723eb5a6cbbd49eee5d96e457b4220160908-4298-ujm8kq.jpg[0]'
Command :: convert '/var/folders/sk/74r24jps5_j1f5q9y_6fd51w0000gn/T/0f78723eb5a6cbbd49eee5d96e457b4220160908-4298-ujm8kq.jpg[0]' -auto-orient -resize "397x312>" '/var/folders/sk/74r24jps5_j1f5q9y_6fd51w0000gn/T/b5e82b87117f82d588c21a40c76ec97c20160908-4298-n6da0p'
Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/sk/74r24jps5_j1f5q9y_6fd51w0000gn/T/0f78723eb5a6cbbd49eee5d96e457b4220160908-4298-ujm8kq.jpg[0]' 2>/dev/null
Command :: identify -format %m '/var/folders/sk/74r24jps5_j1f5q9y_6fd51w0000gn/T/0f78723eb5a6cbbd49eee5d96e457b4220160908-4298-ujm8kq.jpg[0]'
Command :: convert '/var/folders/sk/74r24jps5_j1f5q9y_6fd51w0000gn/T/0f78723eb5a6cbbd49eee5d96e457b4220160908-4298-ujm8kq.jpg[0]' -auto-orient -resize "100x100>" '/var/folders/sk/74r24jps5_j1f5q9y_6fd51w0000gn/T/b5e82b87117f82d588c21a40c76ec97c20160908-4298-1tb73y2'
Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/sk/74r24jps5_j1f5q9y_6fd51w0000gn/T/0f78723eb5a6cbbd49eee5d96e457b4220160908-4298-ujm8kq.jpg[0]' 2>/dev/null
Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/sk/74r24jps5_j1f5q9y_6fd51w0000gn/T/c06283a145cec10266dcb825b052a20e20160908-4298-14u9yd3[0]' 2>/dev/null
Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/sk/74r24jps5_j1f5q9y_6fd51w0000gn/T/e75968bebf5649ffe653917264a0ddf720160908-4298-85kjdk[0]' 2>/dev/null
Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/sk/74r24jps5_j1f5q9y_6fd51w0000gn/T/7315b35cf9a9b951913efcee71b0293220160908-4298-1bj4r8e[0]' 2>/dev/null
Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/sk/74r24jps5_j1f5q9y_6fd51w0000gn/T/ad0f825c6e0c09039dc5e1e0fd799b3220160908-4298-1v4t1ic[0]' 2>/dev/null
Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/sk/74r24jps5_j1f5q9y_6fd51w0000gn/T/4b8aa39e6a7ecf2a0264b9d916a0f3db20160908-4298-13zoe7b[0]' 2>/dev/null
Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/sk/74r24jps5_j1f5q9y_6fd51w0000gn/T/f0779f0abfe2bd9e1922f98ead210ed120160908-4298-1aiazgj[0]' 2>/dev/null
*** ArgumentError Exception: wrong number of arguments (given 2, expected 1)
更新: 基本的にはすべてのものがImage
オブジェクトを作成することに帰着します。 このようなコンソールで試してみると、同じエラーが発生します。 http://api.rubyonrails.org/classes/ActionDispatch/TestProcess.html#method-i-fixture_file_upload
Image.create(
attachment: Rack::Test::UploadedFile.new("#{Rails.root}/lib/files/images/sample.jpg", 'image/jpg')
)
私はmime_type
のparamを削除する場合しかし、すべてが正常に動作します。
Image.create(
attachment: Rack::Test::UploadedFile.new("#{Rails.root}/lib/files/images/sample.jpg")
)
実際のシナリオでどのように動作させることができますか?
ライン#エラーが発生した:ここで は
image.rb
の最終版ですか? – RAJを参照してください 'estates_controller.rb'#ここで私は例外を取得します。 '@image = @ estate.images.create(image_params)' – Pav31
'image_params'に' params.require(:image)を置き換えてください。'' params.require(:image).permit(image_attributes) 'を使って' 'permit(* image_attributes) – RAJ