Ruby On Rails Classroom image

Pooja  Negi / Student / Web Technology

 
To post your Question Join Classroom
 
Lesson Topics's No:-  First|1 | 2 | 3 | 4 | 5|Last
Lessons:- The destroy Action

Note that the destroy action uses method chaining to combine the find and destroy into one line:

User .find(params [:id ] ).destroy

 

As constructed, only admins can destroy users through the web, because only admins can see the delete links. Unfortunately, there’s still a terrible security hole: Any sufficiently sophisticated attacker could simply issue DELETE requests directly from the command line to delete any user on the site. To secure the site properly, we also need access control on the destroy action, so our tests should check not only that admins can delete users, but also that other users can’t. The results appear in Listing 9.47. Note that, in analogy with the put method from Listing 9.11, we use delete to issue a DELETE request directly to the specified URI (in this case, the user path, as required by Table 7.1).  

 

 

 

 
 
 
image
Pooja   Negi

Skills    Ruby On Rails

Qualifications :- High School - SSN high school, College/University - HNBGU, College/University - SRHU,
Location :-Ranipokhari,Rishikesh,Uttarakhand,India
Description:- Student
Explore
 

  Students (0)