rails conditional show -


how can render show action on conditions?

def show   @post = post.find_approved   if @post.approved       approved = true   end   respond_to |format|     # want render show.html.erb if approved true if not redirect user came   end end 

redirect_to :back unless approved respond_to |format|   render whatever end 

Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -