Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating Refinery does not change old bigint columns to int #3477

Open
Znow opened this issue Jun 9, 2020 · 5 comments
Open

Updating Refinery does not change old bigint columns to int #3477

Znow opened this issue Jun 9, 2020 · 5 comments

Comments

@Znow
Copy link
Contributor

Znow commented Jun 9, 2020

Hi,

Finally found the solution to my issue, where I could not access the "Files" tab, due to this error:

undefined method `new' for BigDecimal:Class

The solution for me to this, is to go through the whole schema.rb, and change "bigint" columns to "integer" columns, which is not fixed by refinerycms upgrade.

So to elaborate, I had a older version of refinerycms running - upgrading to latest version 4.0.3 caused the above issue.

I think this should be fixed as a migration that changes the column types, since it is causing the issue.

Regards

@Znow
Copy link
Contributor Author

Znow commented Jun 9, 2020

All though trying to update columns to integer, did not fix the issue when trying to add a file:

Skærmbillede 2020-06-09 kl  12 11 40

@marcelino056
Copy link

We have the same issue, some fix for this problem? in our case we don't have bigint inside schema.rb

@marcelino056
Copy link

marcelino056 commented Dec 11, 2020

According to quick research, the problem is located inside activesupport gem, we are using rails 5.1.7. When it
try to show this dialog, it'll try to display the max file size in to a label but method number_to_human_size is returning this error.

I test removing this line and it works.

<label><%= t('.maximum_image_size', bytes: number_to_human_size(Refinery::Images.max_image_size)) %></label>

Internally the method try de initialize a new BigDecimal instance but this is not a class
lib/active_support/number_helper/rounding_helper.rb:37:in `round_significant'

        def round_significant(number)
          return 0 if number.zero?
          digits = digit_count(number)
          multiplier = 10**(digits - precision)
          (number / BigDecimal.new(multiplier.to_f.to_s)).round * multiplier
        end

@parndt
Copy link
Member

parndt commented Jul 8, 2021

Thanks for the investigation. Do you think that we can do anything to Refinery::Images.max_image_size to make this compatible?

@parndt
Copy link
Member

parndt commented Jul 8, 2021

I think this should be fixed as a migration that changes the column types, since it is causing the issue.

Which database server is this happening with?

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

No branches or pull requests

3 participants