Validating uniqueness of nested data. Using cocoon gem
问题 I currently have a Client model that has_many pricings. Pricings table: create_table "pricings", force: true do |t| t.integer "product_id" t.integer "client_id" t.decimal "unit_price" t.datetime "created_at" t.datetime "updated_at" end Pricings model: class Pricing < ActiveRecord::Base belongs_to :client belongs_to :product validates :unit_price, presence: true end Client model: class Client < ActiveRecord::Base has_many :deliveries has_many :collections has_many :pricings accepts_nested