Skip to content

Instantly share code, notes, and snippets.

@killthekitten
Created July 23, 2013 17:16

Revisions

  1. killthekitten created this gist Jul 23, 2013.
    11 changes: 11 additions & 0 deletions models.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    class TariffSchemeFeeRule < ActiveRecord::Base
    belongs_to :tariff_scheme
    belongs_to :fee_rule
    belongs_to :currency

    validates :currency_id, uniqueness: { scope: [:fee_rule_id, :tariff_scheme_id] }, presence: true
    end

    class TariffScheme < ActiveRecord::Base
    accepts_nested_attributes_for :tariff_scheme_fee_rules, allow_destroy: true
    end