Module: Super::Compatability
- Defined in:
- lib/super/compatibility.rb
Class Method Summary collapse
-
.errable_fields(field) ⇒ Object
Rails 5.1 and after lets you find field errors using either a string or a symbol.
- .sanitize_sql_like(query) ⇒ Object
Class Method Details
.errable_fields(field) ⇒ Object
Rails 5.1 and after lets you find field errors using either a string or a symbol.
9 10 11 12 13 14 15 |
# File 'lib/super/compatibility.rb', line 9 def errable_fields(field) if Rails::VERSION::MAJOR == 5 && Rails::VERSION::MINOR == 0 [field.to_s, field.to_sym] else field end end |
.sanitize_sql_like(query) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/super/compatibility.rb', line 17 def sanitize_sql_like(query) if ActiveRecord::VERSION::MAJOR == 4 ActiveRecord::Base.send(:sanitize_sql_like, query) elsif ActiveRecord::VERSION::MAJOR == 5 && ActiveRecord::VERSION::MINOR <= 1 ActiveRecord::Base.send(:sanitize_sql_like, query) else ActiveRecord::Base.sanitize_sql_like(query) end end |