Forum: Ruby on Rails Should I have private and public controllers?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Daniel -. (Guest)
on 2007-04-21 11:31
(Received via mailing list)
I have a resource where there can be private or public items.

If an item is public then no login is required to view, but if it's
private then only the owner should be able to see it.

I've thought that I will just have two controllers.  One for when
people are logged in and checks for privacy and stuff, and another
that just does public access.  Is this ok or is there a problem
because there will effectively be two URL's to the one resource?

Anyone has a thougt on this?

Cheers
Daniel
Conrad T. (Guest)
on 2007-04-22 00:17
(Received via mailing list)
Hi, you should simply use an authentication system like
acts_as_authenticated to protect the relevant areas of your site.

Good luck,

-Conrad
Daniel -. (Guest)
on 2007-04-23 03:18
(Received via mailing list)
On 4/22/07, Conrad T. <removed_email_address@domain.invalid> wrote:
>
>
> Hi, you should simply use an authentication system like
> acts_as_authenticated to protect the relevant areas of your site.
>
> Good luck,
>
> -Conrad


Hi Conrad,

I use the restful_authentication plugin.  The items are model instances
and
so are not constrained by permissions on controllers.  Hence the
question.

The owner of items may have a collection of public and a collection of
private items.  Another person, or an anonymous user should be able to
access these public items.  whether logged in or not.

I think I'm going to go for two controllers with different layouts.
That
way I can have public actions on the public layout and logged in actions
in
the private layout, and the logic is kept reasonably seperate.

Thanx for your input though.

Cheers
This topic is locked and can not be replied to.