Open carlosgab83 opened 1 year ago
You could monkey patch it. In order to overcome this error for our project we added a timestamptz.rb
file in the folder lib/rails_admin/config/fields/types/
and we then had to require it explicitly in lib/rails_admin/config/fields/types/all.rb
The contents of timestamptz.rb
can be the same as timestamp.rb
Hi @shamangeorge, Thanks for your response. It works!.
Some considerations for someone facing the same issue:
timestamptz.rb
in lib/rails_admin/config/fields/types/
Timestamptz
It works as expected, even is applying the time zone correctly when save/update a record.
However i think this issue must be fixed in order to avoid this workaround
Having a postgreSQL table with a
timstamp with time zone
field type produce:Unsupported field datatype: timestamptz
error while rails_admin access the model, http://localhost:3000/client
Reproduction steps
timstamp with time zone
Expected behavior It must accept this data type as previous versions does
Stack
Stack trace
Context
If i change the type of the field to "timestamp without time zone", it works fine, but i need the time zone.
I know this was supported because it worked with rails_admin 2 and rails 5.
Inspecting the error in the gem i can see there are not a :timestamptz key in the types registry, but :timestamp only.
rails_admin (3.1.2) lib/rails_admin/config/fields/types.rb:14
PostgresSQL table definition:
Model definition:
app/models/client.rb