【问题标题】:Mongodb and DeviseMongodb 和设计
【发布时间】:2014-06-09 17:13:44
【问题描述】:

我在 mongo 数据库上使用设计的实现。我需要一个下拉菜单出现在我的注册视图中,所以我添加了以下行:

<%= f.select :status, options_for_select(["Viewer", "Standard", "Tutor"])%>

我还添加到 user.rb 模型中:

field :status, :type => String, :default => ""

但是当我检查数据库时,状态字段显示为空。

【问题讨论】:

    标签: ruby-on-rails devise mongoid


    【解决方案1】:

    试试这个:

    <%= f.select :status, [["Viewer","Viewer"], ["Standard","Standard"], ["Tutor","Tutor"]], { :include_blank => "Please select" }  %>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-29
      • 2011-01-21
      • 2012-08-25
      • 2011-05-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多