I have been having issues with the way I want to write my if else logics in the new action of my controller. For instance a user has two different fildes in the user table, let us say premium_user and gold_user. How will I write an if else statement that says if a user is a premium user he can upload 3 books and if the user is a gold user he can upload unlimited books and of he is just a user without gold or premium he can only upload 2 books in the new action of my controller. Thank you
Share
Logic belongs into your model. You would probably set up an STI Table which defines your user (silver, gold, usual folks,…) and manage authorisations with e.g CanCan.
From there, you just need to update your view based on the type of your user.