Ruby On Rails different views for same action (Based on User's role) -


i have ruby on rails controller display different form logged out user logged in user.

what best way approach this? (is below way ok?)

   class userscontroller < applicationcontroller       def index         if logged_in && is_admin           render 'admin_index'         end         #use default index       end     end 

sure thats fine except might 'cannot render action twice' type error (if im admin , logged in still try render default after rendering admin action)

 class userscontroller < applicationcontroller       def index         if logged_in && is_admin           render 'admin_index'         else           render          end        end     end 

might better


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -