I'm using ActiveAdmin in Rails.
My use case is similar to currency-exchange: say I have 10 currencies, and one currency can be converted into another one. In order to support editing, I need to create a matrix, where rows is CurrencyA, and columns is CurrencyB, and the value is conversion from CurrencyA to CurrencyB, something like this:
| | SGD | USD | HKD | CNY |
|-----|-----|-----|-----|-----|
| SGD | | | | |
| USD | | | | |
| HKD | | | | |
| CNY | | | | |
Correspondingly, in my database, I have a table called currency_conversions
, where it has:
from_currency | to_currency | conversion_rate
(My actual use case is not currency conversion, but this example can better show my use case).
However, I cannot find activeadmin have such functionality.. any suggestions?
After quite some investigation, I've figured out
Here's how it looks like (the data is fake):
Here's what I did:
app/assets/stylesheets/active_admin.css.scss
More over, since I've got an upvote today, let me share my code for the view here(it is
.html.slim
format); I'm reusing it several times: