Hi, This is a question about the best way to develop an application with different user rights. According to the user rights, i want to display the same views but with small differences (like additional buttons if the user is an admin, moderator, etc). The problem (I think) is that I''ve put a lot of logic in my views (if admin then... else... etc). is that the best way to deal with user rights in the views? Thanks for your advices. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Nicolas Blanco wrote:> Hi, > This is a question about the best way to develop an application with > different user rights. > > According to the user rights, i want to display the same views but with > small differences (like additional buttons if the user is an admin, > moderator, etc). > > The problem (I think) is that I''ve put a lot of logic in my views (if > admin > then... else... etc). is that the best way to deal with user rights in > the views? > > Thanks for your advices. > >You could use helpers. -- Jack Christensen jackc-/SOt/BrQZzMOf2zXYvRtkodd74u8MsAO@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 -~----------~----~----~----~------~----~------~--~---
some pseudocode: #view: admin_link_to { :action => delete } #helper: def admin_link_to(options) if @user.has_role(''Admin'') #or however your rights system works ... link_to(options) end end --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
look into acts as authenticated plugin. checkout how the admin/user has their own view. you can just basiclly take your public view, copy it into the admin view and add all the buttons youd like. Nicolas Blanco wrote:> Hi, > This is a question about the best way to develop an application with > different user rights. > > According to the user rights, i want to display the same views but with > small differences (like additional buttons if the user is an admin, > moderator, etc). > > The problem (I think) is that I''ve put a lot of logic in my views (if > admin > then... else... etc). is that the best way to deal with user rights in > the views? > > Thanks for your advices.-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---