I am new using rails, I am trying to add to a user form a list of icon images and the user should select the icon he wants to have as icon. My problem is that I want to save the selected image in a field from user called "icon_id", on my user_controller I have de function where I find all icons @icons = Icon.find(:all) When I submit the form it doesn't save the selected radio button in that field. I hope someone can help me! Thanks in advance!!!
My code is: <%= stylesheet_link_tag 'top' %> <%= javascript_include_tag :defaults %> <%= error_messages_for :user %> <% form_for :user, :url => users_path do |f| -%>
<div class="boxform"> <div id="formulario"> <fieldset> <p><label for="login"><%= _('Login') -%></label><br/> <%= f.text_field :login %></p>
<p><label for="email"><%= _('Email') -%></label><br/> <%= f.text_field :email %></p>
<p><label for="password"><%= _('Password') -%></label><br/> <%= f.password_field :password %></p>
<p><label for="password_confirmation"><%= _('Confirm Password') -%></
<br/>
<%= f.password_field :password_confirmation %></p> <p> <label> <%= _('Select the icon you would like to have if you don not have a gravatar at gravatars.com:')%> </label></p>
<% for icon in @icons %> <img class="imgicon" src="/images/top/<%=icon.image%>"/> <input type="radio" id="icon_id" name="icon_id" value="<%=icon.id %>"
<%end%></fieldset>
</div> <div id="boton"> <button type="submit"><span><em> <%=_('Sign Up') -%> </em></span></
</div> </div> <% end -%>