Répondre

1

Vous devez enregistrer/enregistrer le résultat de Authentifier, puis ne rendre à votre avis.

Controller:

protected 

def authenticate 
    @authenticated = authenticate_or_request_with_http_basic do |user, password| 
    user == "x4556d4s" && password == "fd55sas64x" 
    end 
end 

Voir:

<%= link_to "New Link", :controller => :links, :action => :new %> 
<table> 
<% @links.each do |link| %> 
    <tr> 
    <td> <%= link_to '+', up_link_url(link), :method => :put %> <%= link.points %> <%= link_to '-', down_link_url(link), :method => :put %> </td> 
    <td> <a href= "<%= link.url %>"> <%= link.title %></a> </td> 

    <% if @authenticated %> 
     <td><%= link_to 'Destroy', link, :confirm => 'Are you sure?', :method => :delete %></td> 
     <td><%= link_to 'Edit', edit_link_path(link) %></td> 
    <% end %> 

    </tr> 
<% end %> 
</table> 
Questions connexes