devise-activegraph
devise-activegraph copied to clipboard
Email translation missing: en.neo4j.errors.models.user.attributes.email.taken
When I try to register a user which already exists, I get the following error: Email translation missing: en.neo4j.errors.models.user.attributes.email.taken
I am using devise-neo4j (2.0.0) bcrypt-ruby (~> 3.0) devise (~> 3.0) neo4j (>= 3.0.0.alpha.6) orm_adapter (~> 0.5.0) railties (>= 3.1) warden (~> 1.2.1)
Have you looked at http://stackoverflow.com/questions/7686013/how-to-translate-active-record-model-validations ?
That looks good and I can probably fix the error myself in this way. But shouldn't the english version already be coming with the gem? This is the first time that I come across the need for a manual translation in an english RoR application. However, this might be because I am still pretty new, so..
I've never run into it, either. What version of Rails, Neo4j gem, etc,...? Neo4j.rb has basic support for i18n in the sense that it'll load a config file if it finds it, but it doesn't get involved beyond that. By default, it looks like it's going into config/locales
and loading all Ruby and YML files it can find.
Rails 4.1.6, Neo4j: 4.1.6, devise-neo4j: 2.0.0 I don't know where it finds the key "en.neo4j.errors.models.user.attributes.email.taken", but maybe we could change it to: "en.errors.messages.taken", which should return "has already been taken" from neo4j-4.1.2/config/locales/en.yml. Would that work?
devise.en.yml does not have an entry like that.
If you think that this bug is not worth the trouble if it comes alone, then I don't mind. I doubt that anyone will even recognize it in my project. Just wanted to help.
I think it's worth figuring out, you are definitely helping. Maybe the settings in Neo4j.rb's en.yml are from an old version of... something? It might be better to add the new message than remove the old one.
I think that the issue might be that in the Rails-specific ActiveRecord-like part of neo4j, it's trying to mimic the way ActiveRecord handles internationalisation and localisation, but is not conforming to the complete spec maybe?
The way ActiveRecord localisation works is it looks for translation keys starting with the most detailed ("en.neo4j.errors.models.user.attributes.email.taken") and then works backwards if keys are blank until it would reach the top level ("en.errors.messages.taken").
So the quick fix would be: Add the full translation key ("en.neo4j.errors.models.user.attributes.email.taken") to @johannesE's project (because adding the full key to devise-neo4j would only work if the model is always going to be named, 'User').
The 'proper' fix would be: Alter the neo4j gem so it handles translations in that fallback way like ActiveRecord does.
That sounds good and makes sense. The quick fix works for me. So I suppose we can close this issue here and open up a new one in the neo4j gem?
I'm having the same issue while using simple_form in my application. Has this issue been open in the neo4j gem repository?