ruby on rails - Issues with Koudoku plan subscription creation on user sign up -


i'm using koudoku accept payment .i have listing , users .setup koudoku gem instructed guides .

how can make every user on app enroll in plan on sign up(i'm using devise) , send info stripe in same process , goal have on free plan , can upgrade in dashboard?

so far have , stuck. 1) create function "create_subscription" in subscription model take parameters subscription params hash

 class subscription < activerecord::base  include koudoku::subscription   belongs_to :user  belongs_to :coupon   def create_subscription     @subscription = subscription.new      plan_id = ::plan.first.id     subscription.subscription_owner = @owner_id     subscription.save     subscription end   

end

2)call function in devise registrations controller

class users::registrationscontroller < devise::registrationscontroller include applicationhelper   def create   super      @user.create_subscription()     # sends email user when user created.     timarchemailer.welcome_email(@user).deliver   end end  

in logs after user creation 1 parameter(user_id) saved in subscriptions tables

  sql (16.0ms)  insert "subscriptions" ("created_at", "updated_at",   "user_id") values (?, ?, ?)  [["created_at", "2015-05-29 07:26:24.993908"], [ "updated_at", "2015-05-29 07:26:24.993908"], ["user_id", 55]]  

so far none of user created have associated enrollement . pointers helpful.


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -