noosfero | Making friends only relate to a person (!1626)

Rodrigo Souto gitlab at mg.gitlab.com
Mon Oct 29 18:17:35 BRST 2018


Rodrigo Souto started a new discussion on app/controllers/my_profile/friends_controller.rb:

>    protect 'manage_friends', :profile
>  
>    def index
> -    @suggestions = profile.suggested_profiles.of_person.enabled.includes(:suggestion).limit(per_page)

You should use a before filter in these situations where you basically encapsulate the whole action code in one `if`. This will keep the action clean.

-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/noosfero/noosfero/merge_requests/1626#note_112953858
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20181029/2fb74819/attachment.html>


More information about the Noosfero-dev mailing list