Last active
December 16, 2015 02:29
-
-
Save maasha/5362806 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rake routes | |
users GET /users(.:format) users#index | |
POST /users(.:format) users#create | |
new_user GET /users/new(.:format) users#new | |
edit_user GET /users/:id/edit(.:format) users#edit | |
user GET /users/:id(.:format) users#show | |
PUT /users/:id(.:format) users#update | |
DELETE /users/:id(.:format) users#destroy | |
delete link in view: | |
<% unless current_user.admin? %> | |
<!-- <p><%= link_to "Delete Profile", @user, method: :delete, data: { confirm: "Confirm delete" } %></p> --> | |
<p><%= button_to "Delete Profile", { :action => "delete", :id => @user.id }, :confirm => "Confirm delete", :method => :delete %></p> | |
<% end %> | |
controller: | |
def destroy | |
User.find(params[:id]).destroy | |
flash[:success] = "User destroyed." | |
redirect_to root_url | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment