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
end
private
def check_account
redirect_to :some_where if current_user.balance < price_per_pic
end
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---