Thank you Jim, that was very helpful. I want my site to be completely
hidden from non-logged-in users, so I needed to know which was the
appropriate before_filter for that. Sounds like login_required is the
best, though adding it to my override of base_controller did not stop
me from being able to see a user's profile ('/username', the show
action of the users controller), so I'm still debugging that.

On Nov 2, 10:19 pm, Jim Ruther Nill <[email protected]> wrote:
> find_user:
> -  finds the user whose login_slug is <APP_URL>/<login_slug>
> -  used mostly in the users controller to determine to whom a certain blog,
> photo, clipping, etc belongs to.
>
> require_current_user
> -  first finds user whose login_slug is <APP_URL>/<login_slug> and compares
> it with current user
> -  mostly used in actions that requires the current_users permission (edit,
> update, create, new)
>
> login_required
> -  user needs to be logged in before performing a certain action like
> creating a comment.
>
> the conditions
>
> if logged_in?
> if current user
>
> are basically the same. :D
>
>
>
>
>
> On Tue, Nov 3, 2009 at 10:53 AM, GregL <[email protected]> wrote:
>
> > Could someone help me understand the different use cases for these
> > methods:
>
> > find_user
> > require_current_user
> > login_required
>
> > For example, all three of those are used inside the photos_controller
> > as before filters and I don't understand why. I want to make sure I
> > have consistent behavior between the built-in CE areas and my own
> > app's areas, so I need to understand the purpose of these to be able
> > to use them correctly.
>
> > And also, in some views like _header.html.haml, I see two similar-
> > looking conditions like:
>
> > if logged_in?
> > if current_user
>
> > I can read the code for these, but it would be super-helpful if
> > someone could give me the high-level idea.
>
> --
> "We do not believe in ourselves until someone reveals that deep inside us is
> valuable, worth listening to, worthy of our trust, sacred to our touch." -
> E. E. Cummings
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CommunityEngine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/communityengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to