我在具有以下关联的项目中使用 simple_form
Company
has_many :users
has_many :projects
User
belongs_to :company
has_many :tasks
Project
belongs_to :company
has_many :tasks
Task
belongs_to :project
belongs_to :user
我正在使用 simple_form 关联输入,如下所示:
<%= f.association :user, :prompt => "Assign To...", :label_method => :first_name, :value_method => :id %>
但我需要它仅列出具有正确 company_id 的用户(与项目所属的用户相同)。有没有办法做到这一点?我做了一些谷歌搜索,到目前为止还没有提出任何内容。