Im trying to install paperclip gem on my rails app and I had 3 problems in succession and I would like to point out to them, it may be related to the last problem :
1- I coulden't install the paperclip dependency "mimemagic" => I solved it by adding the file freedesktop.org.xml.in
and its variable FREEDESKTOP_MIME_TYPES_PATH
to my windows machine.
2 - Then after initializing paperclip I couldn't do the migration => I solved it by adding the version of my rails app which is [6.1] bessid the Active record so it become class AddAttachmentImageToPics < ActiveRecord::Migration[6.1]
.
3- The last problem which Im stuck in is when I type rails db:migrate
I get this message that says :
ArgumentError: wrong number of arguments (given 3, expected 2)
This is the content of my migration file :
class AddAttachmentImageToPics < ActiveRecord::Migration[6.1] def self.up change_table :pics do |t| t.attachment :image end end def self.down remove_attachment :pics, :image endend
the message in cmd :
C:\Users\Admin\Desktop\Ruby\instagrameme>rails db:migrate== 20220205102326 AddAttachmentImageToPics: migrating =========================-- change_table(:pics)rails aborted!StandardError: An error has occurred, this and all later migrations canceled:wrong number of arguments (given 3, expected 2)C:/Users/Admin/Desktop/Ruby/instagrameme/db/migrate/20220205102326_add_attachment_image_to_pics.rb:4:in `block in up'C:/Users/Admin/Desktop/Ruby/instagrameme/db/migrate/20220205102326_add_attachment_image_to_pics.rb:3:in `up'Caused by:ArgumentError: wrong number of arguments (given 3, expected 2)C:/Users/Admin/Desktop/Ruby/instagrameme/db/migrate/20220205102326_add_attachment_image_to_pics.rb:4:in `block in up'C:/Users/Admin/Desktop/Ruby/instagrameme/db/migrate/20220205102326_add_attachment_image_to_pics.rb:3:in `up'Tasks: TOP => db:migrate(See full trace by running task with --trace)