私のRubyonRailsアプリでは、いくつかのデータを作成してdbに保存していますが、今度はレコードのIDを取得する必要があります(保存時)。このIDを取得する必要があります。このレコードについては、他のテーブルで、このIDにバインドされたレコードの配列を作成します(モデルでは、関連付けがあります)。
PriceList.create(:distributor_id => distributor_id, :brand => brand, :article_nr => num_catalog, :price => price, :quantity => quantity, :waittime => waittime)
class PriceList < ActiveRecord::Base
has_many :cross_lists
belongs_to :distributor
end
class CrossList < ActiveRecord::Base
belongs_to :price_list
end
1つに2つの質問として表示される可能性がありますが、メジャーは最初の部分です。