ok, so here's my problem... i'll add the code below... I want to
display users, and as an administrator, give other users
administrative priviledges... so, I would perform this in the users
index page... displaying all users and adding a checkbox next to each
one to give administrative priviledges...

I've tried two methods to do this, the first is submit_tag, and the
second is link_to... When I use submit_tag, then theoretically the
boolean value for 'administrator' in the database should be updated,
but it's not... when I use link_to, the page is updated (i.e. the
checkbox shows the correct value), but the database is not... also,
i'm not redirected to where i'm intended... in the 'update' action of
the controller, I've put:

format.html { redirect_to(:controller => "videos") }

but I get redirected to '/users/:id', with the id of the user i've
just edited... why is this?

anyway, here's the /users/index.html.erb code, i've been stumped on
this for a while now, and haven't been able to find anything via
google... any help appreciated... cheers!

<h1>users</h1>
<table>
        <tr>
                <th>Login</th>
                <th>Email</th>
                <th>Administrator</th>
        </tr>
        <% @users.each do |user| %>
        <tr>
                <td><%=h user.login %></td>
                <td><%=h user.email %></td>

                <% form_for user do |f| %>
                        <% if logged_in? && current_user.administrator? %>
                                <td>
                                        <%= f.check_box :administrator %></p>
                                </td>
                        <% end %>
                        <div id="functions">
                                <td><%= link_to 'Delete', user, :confirm => 
'Are you sure?',
                                :method => :delete %></td>
                                <td><%= link_to 'Save', user, :action => 
:update %></td>
                        </div>
                        <!--<td>
                                <p><%= submit_tag 'Save' %></p>
                        </td>-->
                <% end %>
        </tr>
        <% end %>
</table>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to