# Problems about radio buttons

**URL:** <https://www.ruby-forum.com/t/problems-about-radio-buttons/166093>\
**Category:** Rails\
**Created:** [April 21, 2009, 8:13pm UTC](https://www.ruby-forum.com/t/problems-about-radio-buttons/166093 "2009-04-21T20:13:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 21, 2009, 8:13pm UTC](https://www.ruby-forum.com/t/problems-about-radio-buttons/166093/1 "2009-04-21T20:13:30Z")

</div>

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 active\_staff.name%\>](https://www.ruby-forum.com/admin/staff_edit/<%=%20active_staff.id%0A%>) \<%=h active\_staff.parameter %\>

```
            <td><%= a.radio_button :id, active_staff.id %></td>
            </tr>

```

\<% end %\>

in controller:

def user  
@active\_staffs = Dre.find(:all, :conditions =\> {:status =\> true})  
@inactive\_staffs = Dre.find(:all, :conditions =\> {:status =\> false})  
end

def staff\_demote  
@dre = Dre.find(params[:id])  
@dre.demote  
redirect\_to :action =\> ‘user’  
end

the error messages are:

ActiveRecord::RecordNotFound in AdminController#staff\_demote  
Couldn’t find Dre without an ID

E:/Downloads/InstantRails-2.0/ruby/lib/ruby/gems/1.8/gems/  
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:in `find’  
app/controllers/admin\_controller.rb:44:in `staff\_demote’

Parameters:

{“dre”=\>{“id”=\>“17”},  
“commit”=\>“DEMOTE USER”,  
“authenticity\_token”=\>“5a498e80d3755a3c5caf176665d91d0a5930a4ec”}

thx for any help
