views:

28

answers:

0

Hello, I use CanCan to check user permissions and display or suppress page content conditionally for my users. I want to cache my pages though, and even with fragment caching can't find an elegant solution... for example:

cache do

# much code

  if can?
    # little code
  else
    # little code

# much code

  if can?
    # little code
  else
    # little code

# much code

Surely I'm not alone and there's a good way to do this. What is generally considered the best practice here?

Thanks very much for your input.