Hello. I will appreciate the opinion. What is the standard way of separating admin functions from normal- user functions? before_filter in one controller? Use two controllers, i.e. ProductController and Admin/ ProductController? I want to use map.resources so RESTFul would be better. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I''m curious to this as well, as I am working on a RESTful site that
needs to
have admin-facing pages as well as end-user-facing pages.
I believe the "accepted" solution is to specify a specific layout if
the
user has administrative privileges - I''m guessing this would have to be
done
in the controller action, along the lines of:
def index
# Snip...
respond.do |format|
format.html do
render :layout => ''admin'' if logged_in_user.is_admin?
# Normal user stuff
end
end
end
However, that seems a little crufty to me and not as DRY as it could be
("wet"?) - but I am relatively new to Rails so I don''t know
if it would be
easier to use a before_filter.
On Mon, Mar 3, 2008 at 12:41 PM, JT
<johntanslade-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> Hello. I will appreciate the opinion.
>
> What is the standard way of separating admin functions from normal-
> user functions?
>
> before_filter in one controller?
>
> Use two controllers, i.e. ProductController and Admin/
> ProductController?
>
> I want to use map.resources so RESTFul would be better.
> >
>
--
Wayne Molina
wayne.molina-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
People, people, just make a separate namespace in routing and make some REST controllers in there. You''ll thank yourself in the end. Trying to run multiple states through the same code paths (admin and user states) is just going to be a maintenance headache and will possibly eventually open security holes. On Mar 3, 9:41 am, JT <johntansl...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello. I will appreciate the opinion. > > What is the standard way of separating admin functions from normal- > user functions? > > before_filter in one controller? > > Use two controllers, i.e. ProductController and Admin/ > ProductController? > > I want to use map.resources so RESTFul would be better.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
this was recently discussed on the list http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/5193c5af78810e42/2b9337ccc234f5c6 On 3/3/08, ara_vartanian <ara.vartanian-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > People, people, just make a separate namespace in routing and make > some REST controllers in there. You''ll thank yourself in the end. > Trying to run multiple states through the same code paths (admin and > user states) is just going to be a maintenance headache and will > possibly eventually open security holes. > > > On Mar 3, 9:41 am, JT <johntansl...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hello. I will appreciate the opinion. > > > > What is the standard way of separating admin functions from normal- > > user functions? > > > > before_filter in one controller? > > > > Use two controllers, i.e. ProductController and Admin/ > > ProductController? > > > > I want to use map.resources so RESTFul would be better. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---