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 | 6 | 7 | 8 | 9|Last
Lessons:-Stats and a Follow Form

The core of this test is the expectation that the following and follower counts appear on the page, together with the right URIs:

 

Here we have used the named routes shown in Table 11.1 to verify that the links have the right addresses.

           The application code for the stats partial is just a couple of links inside a div, as shown in Listing 11.20.

 

Since we will be including the stats on both the user show pages and the Home page, the first line of Listing 11.20 picks the right one using

< %  @user  ||= current user  % >

 

As discussed in Box 8.2, this does nothing when @user is not nil (as on a profile page), but when it is (as on the Home page) it sets @user to the current user.

      Note also that the following/follower counts are calculated through the associations using  

@user.followed users.count
 
 
 
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)