Ruby On Rails Classroom image

Neha  Jaggi / Professional / 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
Neha  Jaggi

Skills    Ruby On Rails

Qualifications :- High School - , College/University - Graphic Era Hill University, Dehradun, College/University - ,
Location :-Dehradun,Dehradun,UTTARAKHAND,India
Description:-

Experienced Software Developer with a demonstrated history of working in the Information Technology and services industry. Skilled in Web Technologies (Ruby on Rails, PostgreSQL, php, Laravel and AJAX). 


Explore
 

  Students (0)