Deleting Data After Viewing On Page

My understand is before displaying a picture, you should check the user’s account, if there’s no enough money then redirect to some page to show a notice. Since users and pictures are n:n relationships, if you want to add a column to record times each people view the picture, it would be amount_of_users * amount_of_pics records needed. And I don’t think you need to delete the picture.

before_filter :check_account, :only => :display_pic

def display_pic

random get pic


private def check_account redirect_to :some_where if current_user.balance < price_per_pic end