【发布时间】:2011-11-01 18:30:44
【问题描述】:
我想在模型助手中编写一些方法并在我的视图中渲染。我的产品型号有价格列。例如,在视图中,我希望能够编写 @product.tier_one_quantity_one。 helper怎么写,怎么渲染?
我可以在一个方法中分配多个变量吗?
module ProductsHelper
def price_variation(product)
@tier_one_quantity_one = @product.price * 1.2
@tier_one_quantity_wo = @product.price * 1.4
...
end
end
【问题讨论】:
标签: ruby-on-rails-3 view-helpers