You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to use the i18n helper, an error is raised TypeError: Cannot visit Mobility::Arel::Nodes::Json
Context
We are using mobility with MySQL 5.7 and JSON columns and ActiveRecord 5.2.2. When I try to use the i18n helper, I get an exception:
[1] pry(main)> Product.i18n.find_by(name: "Shirt")
TypeError: Cannot visit Mobility::Arel::Nodes::Json
from /usr/local/bundle/gems/arel-9.0.0/lib/arel/visitors/reduce.rb:21:in `rescue in visit'
Caused by NoMethodError: undefined method `visit_Mobility_Arel_Nodes_Json' for #<Arel::Visitors::MySQL:0x00007fead9544fe0>
from /usr/local/bundle/gems/arel-9.0.0/lib/arel/visitors/reduce.rb:15:in `visit'
My schema looks like this:
create_table "products", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t|
t.json "name"
end
product.rb model:
class Product < ApplicationRecord
extend Mobility
translates :name
end
Expected Behavior
Return results for multiple languages. The SQL Query could look something like this
SELECT `products`.* FROM `products` WHERE ((name->'$.de' = 'Shirt') OR (name->'$.fr' = 'Shirt'))
Actual Behavior
An error is raised.
The text was updated successfully, but these errors were encountered:
When trying to use the
i18n
helper, an error is raisedTypeError: Cannot visit Mobility::Arel::Nodes::Json
Context
We are using mobility with MySQL 5.7 and JSON columns and ActiveRecord 5.2.2. When I try to use the
i18n
helper, I get an exception:My schema looks like this:
product.rb model:
Expected Behavior
Return results for multiple languages. The SQL Query could look something like this
Actual Behavior
An error is raised.
The text was updated successfully, but these errors were encountered: