# Forms and selects

**URL:** <https://www.ruby-forum.com/t/forms-and-selects/172905>\
**Category:** Rails\
**Created:** [July 29, 2009, 8:07pm UTC](https://www.ruby-forum.com/t/forms-and-selects/172905 "2009-07-29T20:07:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![blueomega](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e95f7d/32.png) [@blueomega](https://www.ruby-forum.com/u/blueomega)\
**Post date:** [July 29, 2009, 8:07pm UTC](https://www.ruby-forum.com/t/forms-and-selects/172905/1 "2009-07-29T20:07:13Z")

</div>

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| %\>  
\<%= f.select( :student\_booklet, @user.student\_booklet.all.collect  
{|b| [b.school\_year.year, b.id]}.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](http://localhost:3000/student_booklets/kid793LXJ), were kid793LXJ is  
the user login name. it sould do something like  
[http://localhost:3000/student\_booklets/30/](http://localhost:3000/student_booklets/30/),  
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](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, b.id]}.sort.reverse seems hacky, any idea how to improve it

any help to solve/improve it?

Grats  
Celso Costa
