Friday, December 14, 2012

Re: [Rails] Filter on multiple select

On 13 December 2012 14:23, Lorenz Blackbird <lists@ruby-forum.com> wrote:
> Hello,
>
> I have a many-to-many relationship between the model "exams" and the
> model "students", in the middle I have the model "registrations".
>
> Students are registered to a "course" (another model) and any exam is
> associated to a "course".
>
> I create a view in exams that permit to add the students with multiple
> selection:
>
> <%= f.select :student_ids, Student.all.map { |student| [student.name,
> student.id] }, { }, { multiple: true }
>
> but this solution show me all students in the db. I wish I had only the
> students registered in the same course of exam.

What do you mean by "the same course of exam".

Colin

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate