【问题标题】:Ransack sort with field and with virtual attribute带字段和带虚拟属性的 Ransack 排序
【发布时间】:2014-11-14 10:38:55
【问题描述】:

我是 Rails 新手,我正在学习如何使用它。

我有一个用户模型

has_many :branches, :dependent => :destroy has_many :comments, :dependent => :destroy

它有一个字段 profile_type

我正在这样做

  <%= search_form_for @search , url: news_path do |f| %>

    <%= f.select :profile_type_eq, [['Doctors', 1], ['Professors', 0], ['Teachers', 2]],
                 include_blank: "All Account Types" %>
    <%= f.submit 'Filter Accounts'%>

<% end %>

我需要能够添加另一个下拉菜单和另一个按钮来过滤具有大多数 cmets 或大多数分支的示例配置文件类型医生。我怎样才能通过洗劫来做到这一点?

【问题讨论】:

    标签: ruby-on-rails ransack


    【解决方案1】:

    我认为根本不可能,就像不可能通过 has_one 关联进行搜索

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-30
      • 1970-01-01
      • 2013-08-20
      • 1970-01-01
      • 2015-10-24
      • 2019-03-29
      相关资源
      最近更新 更多