Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Public vs. Private Status'

I've been working on extending the Treebook application and one of the concepts I've added is a flag on the status to either make the status a 'public' i.e. seen by other users or 'private' status only seen by the current user.

Right now I make this check in the status index view with this code

    <% if status.visable == true || status.user_id == current_user.id %>

I'm pretty sure this violates the DRY principle though as there maybe other pages where you want to a list of status so I would assume you that you would want to move this to a method and call that method in the status controller in the index method however, after many hours on Google I haven't found a way that works.

1 Answer

Brandon Barrette
Brandon Barrette
20,485 Points

What's your question? I'm not sure I understand the issue you're having.