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
{{ message }}
Repository navigation
Payment method preferences returns different object types depending on setup #3717
When setting up a payment_method, if you don't use static model preferences, you get a Hash object when you call payment_method.preferences. If you do use static model preferences, you instead get a Spree::Preferences::StaticModelPreferences::Definition object when you call payment_method.preferences
While using the default preference source, this command will succeed: payment_method.preferences[:available_to_users]
While using static model preferences, the same command will fail.
Solidus Version:
2.10 - though likely an issue in more versions
To Reproduce
Create a Check payment method
Set it to use a static model preference (example provided below)
Open a console, run Spree::PaymentMethod.last.preferences[:test_mode] - it will fail
Set the payment method to use the "custom" preference source
In the console, run Spree::PaymentMethod.last.preferences[:test_mode] - it will succeed
changed the title [-]Static model preferences returns a different [/-][+]Payment method preferences returns different object types depending on setup[/+]on Jul 21, 2020
Activity
[-]Static model preferences returns a different [/-][+]Payment method preferences returns different object types depending on setup[/+]peterberkenbosch commentedon Jul 22, 2020
Using
preferred_prefix for the preferences works on both setups. I do agree the hash option is more Ruby idiomatic :)