Open ThomasSysOps opened 9 years ago
@ThomasSysOps Are you using Devise? If so, you should also use CanCanCan to handle authorization
Hey @yas4891, Yes, I'm using Devise. I will check CanCanCan now.
Thank you very much I think this will solve my issue, however do you happen to have an example of the ability.rb for Koudoku?
For those who also has the same issue my solution was to add this to my controller.
def page
if !current_user
redirect_to "/pricing"
else
if Subscription.exists?(:user_id => current_user.id)
else
redirect_to "/pricing"
end
end
Hello everyone,
I'm pretty much a beginner in Rails, I have installed Koudoku and tested the payment method, however I'm not sure how to protect a page. I want the page only viewed by who subscribe to our services. How can I do that?
I have tried to setup something like this in my home controller if current_owner and current_owner.subscription.present? but the current_owner is not set.
Best Wishes, Thomas