首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >集合中的单选按钮

集合中的单选按钮
EN

Stack Overflow用户
提问于 2016-12-16 09:45:59
回答 1查看 997关注 0票数 0

我试图返回一套单选按钮的基础上,在我的数据库,但我没有太多的运气。

查看代码

代码语言:javascript
复制
- @merchant_type.each do |mt|
    = form.radio_button mt, mt.name

控制器码

代码语言:javascript
复制
def new
    @merchant_type =  MerchantType.all
    @merchant = Merchant.new
    @states = State.form_selector
    @products = Product.order(:name => 'asc')
    @properties = Property.where(property_set_id: 1)
    @merchant.trading_hours.build
  end

错误

代码语言:javascript
复制
ActionView::Template::Error (undefined method `#<MerchantType:0x007fd16b55ac50>' for #<Merchant:0x007fd16c481468>):
    6:     p
    7:       b Type
    8:       - @merchant_type.each do |mt|
    9:         = form.radio_button mt, mt.name
  app/views/admin/merchants/_type.html.slim:9:in `block in _app_views_admin_merchants__type_html_slim___3402008222164699688_70268702644260'
  app/views/admin/merchants/_type.html.slim:8:in `_app_views_admin_merchants__type_html_slim___3402008222164699688_70268702644260'
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-12-16 10:13:15

尝尝这个

代码语言:javascript
复制
- @merchant_type.each do |mt|
    = form.radio_button :merchant_type, mt.name
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41181416

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档