Skip to content

Instantly share code, notes, and snippets.

Last active Sep 24, 2015
What would you like to do?
class TransactionCost < ActiveRecord::Base
belongs_to :company
belongs_to :app
has_many :range_costs
accepts_nested_attributes_for :range_costs, allow_destroy: true, reject_if: lambda { |a| a[:to].blank? && a[:from].blank? && a[:cost].blank? }
validates :app_id, uniqueness: true
validates :range_costs, presence: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment