Updated README for manually adding invalid message (#47)
This commit is contained in:
parent
18701f7ae4
commit
5b352687fc
16
README.md
16
README.md
|
@ -120,3 +120,19 @@ class ActionDispatch::IntegrationTest
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Invalid message without Devise
|
||||||
|
|
||||||
|
When you are using this gem without Devise, you may find out that the invalid message is missing.
|
||||||
|
For this case, use the trick below to manually add your i18n invalid message.
|
||||||
|
|
||||||
|
```rb
|
||||||
|
if verify_rucaptcha?(@user) && @user.save
|
||||||
|
do_whatever_you_want
|
||||||
|
redirect_to someplace_you_want
|
||||||
|
else
|
||||||
|
# this is the trick
|
||||||
|
@user.errors.add(:base, t('rucaptcha.invalid'))
|
||||||
|
render :new
|
||||||
|
end
|
||||||
|
```
|
||||||
|
|
Loading…
Reference in New Issue