RubyMoney/money-rails

Top-level include of view helpers for rails_admin causes conflicts

perezperret opened this issue · 0 comments

If RailsAdmin is present, a top-level include of MoneyRails::ActionViewExtension happens. It has caused trouble for us because since we have rails_admin installed, all our objects have currency_symbol defined.

In our specific use-case, we are using graphql-ruby, where you define a "type" class and annotate it with the field names. If a field name corresponds to a method on the "type" class, it'll use that method, otherwise it'll fall back on the model that corresponds to the type.

We have types with currency_symbol fields. Since all our objects now have currency_symbol defined, this fallback doesn't work as intended, and since the helper methods rely on ActionView it raises an exception.

In case someone else has the same problem, you can work around this by explicitly defining currency_symbol in your "type" class (you can reference the underlying model through the object method).