BananaCrystal / email-templates

This repository contains in-house email templates that serve as structure for our emails. Each template can be updated and modified to fit requirements.
MIT License
0 stars 0 forks source link

exchange_rates.rb #20

Open geekelo opened 3 months ago

geekelo commented 3 months ago

FILE

ActiveAdmin.register ExchangeRate do

  # config.sort_order = 'name_asc'

  menu parent: 'Currencies', label: 'Exchange Rates'

  # See permitted parameters documentation:
  # https://github.com/activeadmin/activeadmin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters
  #
  # Uncomment all parameters which should be permitted for assignment
  #
  permit_params :from, :to, :rate, :buy_rate, :sell_rate,
                :override, :override_rate, :override_buy_rate, :override_sell_rate,
                :override_label, :override_source, :override_updated_at
  #
  # or
  #
  # permit_params do
  #   permitted = [:from, :to, :rate]
  #   permitted << :other if params[:action] == 'create' && current_user.admin?
  #   permitted
  # end
end
geekelo commented 3 months ago

This code registers the ExchangeRate model with ActiveAdmin, enabling the management of exchange rates through the admin interface. Here's a breakdown of the key elements of the code:

1. Menu Configuration

2. Permitted Parameters

3. Commented Configuration

4. Additional Parameter Customization

Summary

This configuration sets up an admin interface for managing exchange rates in your system. By defining which parameters are permitted for modification, it ensures that the system is secure while still being flexible for administrators to manage the exchange rates, including the ability to override rates and specify additional details about those overrides.