globalize/globalize

Translated columns are excluded from Model.column_names

owen2345 opened this issue · 5 comments

Dependencies

Rails 6.1.3.2 ruby '2.7.1' gem 'rails', '~> 6.1.3', '>= 6.1.3.2' gem 'mysql2', '~> 0.5'

Model

# Table name: campaigns
# id ...
# description ...
class Campaign < ApplicationRecord
  translates :description, fallbacks_for_empty_translations: true
end

Output without translation:

Campaign.column_names # => ["id", "description"]

Output with translation ("description" column does not appear):

Campaign.column_names # => ["id"]

Additionally, it is not autocompleting query values (most critical part)

Campaign.where(description: "sample descr").new.description # ==> nil, should be "sample descr"'

mck9 commented

Also the column types are left out on the model:

Campaign # => Campaign(id: integer, description: )

should be:

Campaign # => Campaign(id: integer, description: string)

stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

I've also just run into this issue that @mck9 mentioned here. Has anyone found a solution?

The columns being missing from SomeModel.columns is causing issues with ransack, so I'm investigating this and need to come up with a fix. I've booked some time with my team to dig into this on Monday, so if anyone has any additional they can provide, let us know.

stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.