The presence plugin doesn't work as expected
KonstantinReido opened this issue · 1 comments
KonstantinReido commented
Context
- rails (5.2.8.1)
- mobility (1.2.9)
- Postgres
My config file:
Mobility.configure do
plugins do
backend :key_value, type: :string
active_record
reader
writer
backend_reader
query
cache
fallbacks({ :"en-GB" => :"nb-NO" })
presence
locale_accessors
dirty
end
end
Expected Behavior
After adding the plugin to the config by default it applies to all translations.
Actual Behavior
I need to write presence: true
to each translation to make it work
Steps to reproduce
Activate the plugin in the config, then do the next steps:
- Store a value to a translation.
- Try to change the translation on an empty string.
- In DB old record was deleted and a new one was created with nil in the
value
column - Try again to store an empty string for the translation
- At this time record with nil in the
value
column deleted
If on a model level for each translation, I define presence: true
, then it works as expected.
shioyama commented
You need to provide a reproducible example for your problem. The presence plugin has been around for years and there are specs checking that it works, so it's very unlikely that there is an issue. More likely it's some kind of compatibility issue or you are not understanding how it works.