ruby on rails - Better Way to Check For Stripe Subscription Memberships with Payola -


i'm using payola rails framework take payments app. issue is, unable locate valuable helper methods checking status of current_user. wrote method below show membership status have @ present moment. when subscriptionplan class deleted, whether migrating production environment or maintenance. automatically changes id class objects. so, renders method useless. how can re-write method grab more informative attribute won't fail when migrate production level.

user.rb

  def stripe_membership_checker     case       when self.subscription_plan_id.nil?         "normal user"       when self.subscription_plan_id == 10         "gold"       when self.subscription_plan_id == 9         "silver"       else         ""     end   end 

subscription_plan.rb

class subscriptionplan < applicationrecord   include payola::plan   has_many :users    def redirect_path(subscription)     '/'   end end 


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -