Hi guys, 

This seems to be a pretty common thing, but I just cannot figure it out ... 
I opened a thread on the simple_form group already, but I thought I'll ask 
the smart brains here too :)

I have a has_many through association 

class User
  has_many :task_assignments
  has_many :tasks, through: :task_assignments
end

class TaskAssignment
  belongs_to :user
  belongs_to :task

  scope :actives, where("disabled = ?", false)
  scope :inactives, where("disabled = ?", true)
end

class Task
  has_many :task_assignments
  has_many :users, through: :task_assignments
end

On TaskAssignment, I have a disabled boolean field.

On the user form, I want to list all non-disabled TaskAssignments, but by 
default 

f.association :task_assignments, collection: Task.all

selects all assignments including the disabled ones.

How do I make f.association not pre-select disabled task assignments, when 
I'm editing an existing user?

Thanks
Jim

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
or Rails Oceania" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rails-oceania/-/_YQPp4CcGt0J.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rails-oceania?hl=en.

Reply via email to