Guest User

Untitled

a guest
Jun 18th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. THis is the update controller:
  2. def update
  3. @ad = Ad.find(params[:id])
  4. @ad.update_attributes(:id =>params)
  5. redirect_to "/ads/#{ @ad.id }"
  6. end
  7.  
  8. and this is the security controller:
  9.  
  10.  
  11. before_filter :check_logged_in, :only=> [:edit, :update, :destroy]
  12.  
  13. private
  14. def check_logged_in
  15. authenticate_or_request_with_http_basic("Ads") do |username, password|
  16. username == "admin" && password == "password"
  17. end
  18. end
Add Comment
Please, Sign In to add comment