I know this is a basic problem with a very simple solution but I'm new to ruby and rails so I'm a bit confused why this isn't working
I want to be able to create a select tag which is linked with a particular model, so I used this code in the view
<%= start_form_tag :action => 'index'%>
<%= text_field("user", "user_name")%> <%options = [["","0"], ["Low","1"],["High","2"]]%> <%=select("user", "level", options)%>
<%= submit_tag 'test'%>
<%= end_form_tag %>
here's the controller code
class TestController < ApplicationController
def index @user = User.find_by_id(params[:id]) end
end
I tested the above code using a user record with the field level containing 2 and the select list did not default to 2 but stayed at the empty option
As I said before, I'm sure I'm missing something obvious here but I haven't a clue what, any ideas?
Cheers
Teesea