我使用的一个项目,我有以下的关联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联想输入与父母使用simple_form /子账户:
<%= f.association :user, :prompt => "Assign To...", :label_method => :first_name, :value_method => :id %>
但我需要它仅列出具有正确的company_id的用户(与项目所属的相同)。有没有办法做到这一点?我做了一些Google搜索,到目前为止没有提出任何内容。
谢谢,我找到了一种方法尽管如此,以处理它。我发布了我的答案。 – nathan