Ruby On Rails Classroom image

Pooja  Negi / Student / Web Technology

To post your Question Join Classroom
Lesson Topics's No:-  |1 | 2 | 3|Last
Lessons:-Deleting Users-Administrative Users

Deleting Users

Now that the user index is complete, there’s only one canonical REST action left: destroy. In this section, we’ll add links to delete users, as mocked up in Figure 9.12, and define the destroy action necessary to accomplish the deletion. But first, we’ll create the class of administrative users authorized to do so.



Users We will identify privileged administrative users with a boolean admin attribute in the User model, which, as we’ll see, will automatically lead to an admin? boolean method to test for admin status. We can write tests for this attribute as in Listing 9.39.




Here we’ve used the toggle! method to flip the admin attribute from false to true. Also note that the line

it { should be admin }


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

  Students (0)