Ruby On Rails Classroom image

prateek  darmwal / Professional / Web Technology

 
To post your Question Join Classroom
 
Lesson Topics's No:-  First|1 | 2 | 3 | 4|Last
Lessons:- Followed users

To create a following relationship, we’ll introduce a follow! utility method so that we can write user.follow!(other_user). (This follow! method should always work, so, as with create! and save!, we indicate with an exclamation point that an exception will be raised on failure.) We’ll also add an associated following? boolean method to test if one user is following another.7 The tests in Listing 11.11 show how we expect these methods to be used in practice.

 

In the application code, the following? method takes in a user, called other_user, and checks to see if a followed user with that id exists in the database; the follow! method calls create! through the relationships association to create the following relationship. The results appear in Listing 11.12.

 
 
 
image
prateek  darmwal

Skills    Ruby On Rails

Qualifications :- High School - S.K.M. Sn. Sec. School, Haldwani, College/University - Graphic Era Hill University, Bhimtal,
Location :-Dehradun,Dehradun,Uttarakhand,India
Description:- I like to explore new technologies. I have skills in ruby on rails, php5, cakephp, jquery, javascript, html/css, java, c & c++. I love coding
Explore
 

  Students (0)