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

Support show default value for virtual column #308

Open
BuonOmo opened this issue Jan 18, 2024 · 0 comments
Open

Support show default value for virtual column #308

BuonOmo opened this issue Jan 18, 2024 · 0 comments
Labels
rails 7.1 issue introduced in rails 7.1

Comments

@BuonOmo
Copy link
Collaborator

BuonOmo commented Jan 18, 2024

There's an edge case where a virtual column referencing a column with default value is created, the virtual column returns nil if the user doesn't force model reloading (#reload).

Test failing:

  • test_fills_auto_populated_columns_on_creation

Investation

As of now, I found out that the generated sql on insert doesn't include the virtual column, and it seems to be on purpose (See PostgreSQL::Column#has_default? or Column#auto_populated?). Hence the next step would be to verify the related behaviour with the postgresql adaptor directly to see when the value is added to the model.

@BuonOmo BuonOmo added the rails 7.1 issue introduced in rails 7.1 label Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rails 7.1 issue introduced in rails 7.1
Projects
None yet
Development

No branches or pull requests

1 participant