I'm trying to generate a list of users with two radio buttons next to
each user where I can either approve or reject a user, all in the same
form.
The following code, illustrates what I am trying to do and the error I
am getting.
Does anybody know how to do this? Thanks in advance! - Cheri
create_table "users", :force => true do |t|
t.string "name"
t.integer "approval", :default => 0 # 0=needs approval,
1=approved, 2=not approved
end
-------------------
<% form_for [:admin, :user], :url => {:action => "user_approval" } do
|f| %>
<% for user in @users %>
<tr>
<td><%= user.id %></td>
<td><%= user.name %></td>
<td><%= user.approval %></td> #current state of the user's
approval status
<td><%= f.radio_button :approval,'1' %>"Approve" </td>
<td><%= f.radio_button :approval,'2' %>"Reject" </td>
</tr>
<% end %>
<p> <%= f.submit "Submit" %> </p>
<% end %>
---------
Error:
undefined method `approval' for :user:Symbol
--~--~---------~--~----~------------~-------~--~----~
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby
-~----------~----~----~----~------~----~------~--~---