Forms and selects

So i want to view only one student booklet, who i define by using a
combo box (select). It only do reads, no writes

<% form_for :student_booklet, :url => student_booklet_path do |f| %>
<%= :student_booklet, @user.student_booklet.all.collect
{|b| [b.school_year.year, ]}.sort.reverse)%>
<%= submit_tag ‘Show’ %>
<% end %>

the box shows the year´s of the booklet, sorted, on selection i should
go to the show method, but:

student_booklet_path should take an :id, so it knows were to go, but
how do i pass the id of the selection? right now it goes to
http://localhost:3000/student_booklets/kid793LXJ, were kid793LXJ is
the user login name. it sould do something like
were 30 is the booklet id

just to test, i hardcoded the path by doing student_booklet_path(30),
doesnt work, it produces http://localhost:3000/student_booklets/30,
notice the lack of /, i get the error No action responded to 30

@user.student_booklet.all.collect{|b| [b.school_year.year, ]}.sort.reverse seems hacky, any idea how to improve it

any help to solve/improve it?

Celso Costa

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs