我有 3 个模型 Shop Section 和 Price,Section 有 shop_id,Price 有 section_id 如何在商店视图中显示价格?
控制器/shop_controller.rb
...
def show
@metod_one = Magazine.find(params[:id])
@method_two = Section.find(:all, :conditions => ['shop_id = ?', @method_one])
@method_three = Price.find(:id, :conditions => ['section_id = ?', @method_two])
end
...
此方法不起作用 Mysql::Error: Operand should contain 1 column(s): SELECT * FROM prices
WHERE ( prices
. id
= '--- :id\n' AND (section_id = 5480,5482,5483,5485))