Problems about radio buttons

i want to set a few radio buttons and if i submit the form , i want to
change the value of the attribute from model
what should i do?

my codes are:

in view :

<% form_for :dre, :id => @dre , :url => { :action => ‘staff_demote’ }
do |a|%>
<% for active_staff in @active_staffs %>

<%=h> <%=h active_staff.parameter %>
            <td><%= a.radio_button :id, %></td>

<% end %>

in controller:

def user
@active_staffs = Dre.find(:all, :conditions => {:status => true})
@inactive_staffs = Dre.find(:all, :conditions => {:status => false})

def staff_demote
@dre = Dre.find(params[:id])
redirect_to :action => ‘user’

the error messages are:

ActiveRecord::RecordNotFound in AdminController#staff_demote
Couldn’t find Dre without an ID

activerecord-2.0.2/lib/active_record/base.rb:1248:in find_from_ids' E:/Downloads/InstantRails-2.0/ruby/lib/ruby/gems/1.8/gems/ activerecord-2.0.2/lib/active_record/base.rb:504:infind’
app/controllers/admin_controller.rb:44:in `staff_demote’


“commit”=>“DEMOTE USER”,

thx for any help

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