Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

"attachment" type migration error in Rails 7 #2698

Open
nikukyugamer opened this issue Dec 17, 2021 · 5 comments
Open

"attachment" type migration error in Rails 7 #2698

nikukyugamer opened this issue Dec 17, 2021 · 5 comments

Comments

@nikukyugamer
Copy link

nikukyugamer commented Dec 17, 2021

For example the below migration file exists.

    change_table :notes do |t|
      t.attachment :attachment
    end

This occurs a migration error as below.

$ bin/rails db:migrate

== 20170519014052 AddAttachmentAttachmentToNotes: migrating ===================
-- change_table(:notes)
rails aborted!
StandardError: An error has occurred, this and all later migrations canceled:

wrong number of arguments (given 3, expected 2)

To fix it, lib/paperclip/schema.rb#attachment should be modified like this.

-            column("#{attachment_name}_#{column_name}", column_type, column_options)
+            column("#{attachment_name}_#{column_name}", column_type, *column_options)

I commited this to my forked repository.
https://github.com/nikukyugamer/paperclip/tree/fix/wrong-number-of-arguments_in_attachement-type

Deprecation notice

Paperclip is currently undergoing deprecation in favor of ActiveStorage. Maintainers of this repository will no longer be tending to new issues. We're leaving the issues page open so Paperclip users can still see & search through old issues, and continue existing discussions if they wish.

@Smailancer
Copy link

Any solutions ?

@sasharevzin
Copy link

Honestly, why not use https://github.com/kreeti/kt-paperclip ?
Works perfectly for me.

@nikukyugamer
Copy link
Author

nikukyugamer commented Feb 7, 2022

Thanks for comments. Due to our dev team circumstances, it is difficult to use other (fork) gems. So I wrote this issue as FIY.

This gem is already deprecated so if this is unnecessary, please close it.

Honestly, why not use https://github.com/kreeti/kt-paperclip ?

This LGTM!

@Smailancer
Copy link

Why its deprecated , Its very useful gem

@henriquesml
Copy link

Honestly, why not use https://github.com/kreeti/kt-paperclip ? Works perfectly for me.

Thanks, kt-paperclip works for me!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants