form.select question

Hello, I am new to rails and have a question about form.select. I understand the examples that have a select drop down selections which map to a column in the model’s database row. What I want to do is provide a drop down list for selections which do not map to a single column in a row but which maps to any one of the columns in the table.

The list would be defined in the model class, named say Book: SORT_TYPES = [[“id”, “id”], [“price”, “price”] [“color”, “color”]]

The form would look something like: <% form_for :book, :url => { :action => :sort } do |form| %> <%= form.select :sort_type, Book::SORT_TYPES, :prompt => “sort reviews by” %> <%= submit_tag “Sort”, :class => “submit” %> <% end %>

When the form is submitted, the sort method of the Book_controller is called and I want to trap the value the user chose from the drop down list of options, each of which is a column in the books table. I know the sort method is called but I can’t seem to get a value from the selection.

So the question is: How do I trap a value from a form.select which is not mapped to a single column from a model’s table but to one of the table’s columns? How about the select return any arbitrary value (one not associated with a database table)?

Any help would be greatly appreciated.

Thanks for your time, Dave Hackenyos daveh@videx.com