Forum: Ruby on Rails Problems about radio buttons

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
on 2009-04-21 22:13
(Received via mailing list)
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 %>
  <td class="rowTitle"><a href="/admin/staff_edit/<%=
                <span class="researcherName"><%=h></
  <td><%=h active_staff.parameter %></td>

                <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'
activerecord-2.0.2/lib/active_record/base.rb:504:in `find'
app/controllers/admin_controller.rb:44:in `staff_demote'


 "commit"=>"DEMOTE USER",

thx for any help
This topic is locked and can not be replied to.