Skip to content

Commit b45bc2e

Browse files
committed
add ability to disable sanity checks via method arg
1 parent 4de8b42 commit b45bc2e

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ Refer to the [Postgres documentation](http://www.postgresql.org/docs/9.4/static/
225225

226226
### Troubleshooting
227227

228-
If you're having problems with `translateable_sanity_check` you can disable those checks vie environment variable `DISABLE_TRANSLATEABLE_SANITY_CHECK=true`
228+
If you're having problems with `translateable_sanity_check` due to non-existing database upon loading, you can disable those checks vie environment variable `DISABLE_TRANSLATEABLE_SANITY_CHECK=true` or by specifying `sanity_checks: false`, for example `translateable :title, sanity_checks: false`.
229229

230230
## TODO
231231

lib/translateable.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ def self.translateable_attribute_by_name(attr)
1212
AttributeValue = Struct.new(:locale, :data)
1313

1414
module ClassMethods
15-
def translateable(*attrs)
15+
def translateable(*attrs, sanity_checks: true)
1616
attrs.each do |attr|
17-
translateable_sanity_check(attr)
17+
translateable_sanity_check(attr) if sanity_checks
1818
define_translateable_methods(attr)
1919
end
2020
define_translateable_strong_params(*attrs)

lib/translateable/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module Translateable
2-
VERSION = '0.2.1'.freeze
2+
VERSION = '0.2.2'.freeze
33
end

0 commit comments

Comments
 (0)