stripe_saas 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f78175401e2d4cef14fddb9cd43fa524f4bb6fcb
4
- data.tar.gz: 2848356cfaa6d9d1ad457b7acf2174094d0f6a35
3
+ metadata.gz: bf4021227c337b34c71aefdfe939c64b19d4d9ca
4
+ data.tar.gz: 3034aa654da34ed9aea889dce314a6fe5d2ebc55
5
5
  SHA512:
6
- metadata.gz: 1f01a1b81fe8e9b988ce7ddb7e1fb8cc27a8eabc0d09209adc232de58014f7fc68f3626a1da36f632c8b6a22df564d8d620de5e2af96221e0111eb517f9780b6
7
- data.tar.gz: d626465c96fde60a7c32fd33cb3defa24364a31c3e6ee2534f56f4fec30e75b7f68ee3c3f3e3d43254af651d06f30cd538fd7e44d9d19b91dee31b389ca9c7e7
6
+ metadata.gz: c77bd85fd0842b18e3bd335924fdbd66ee2ffc888db6baa837e70686d3763dd5d7cfced580130e7da1c9ee551b3d35883f775fb08f01b78f3b9f5601660950a1
7
+ data.tar.gz: 18a6f2dbff9003d8ae9759d4afff37281c2ea53afe760427d550c42b57a1d2ed7e0f992cff8c24c35a1bb56a283434674a62b5a717d08c736dcc7fe67502c885
@@ -78,9 +78,22 @@ module StripeSaas
78
78
  def redirect_to_sign_up
79
79
  # this is a Devise default variable and thus should not change its name
80
80
  # when we change subscription owners from :user to :company
81
- session["user_return_to"] = new_subscription_path(plan: params[:plan])
82
- devise_scope = (StripeSaas.devise_scope || StripeSaas.subscriptions_owned_by).to_s
83
- redirect_to new_registration_path(devise_scope)
81
+ begin
82
+ plan = ::Plan.find(params[:plan])
83
+ rescue ActiveRecord::RecordNotFound
84
+ plan = ::Plan.by_stripe_id(params[:plan])
85
+ end
86
+
87
+ if plan
88
+ unless plan.free?
89
+ session["user_return_to"] = new_subscription_path(plan: plan)
90
+ end
91
+
92
+ devise_scope = (StripeSaas.devise_scope || StripeSaas.subscriptions_owned_by).to_s
93
+ redirect_to new_registration_path(devise_scope, plan: plan)
94
+ else
95
+ redirect_to new_registration_path
96
+ end
84
97
  end
85
98
 
86
99
  def index
@@ -1,3 +1,3 @@
1
1
  module StripeSaas
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
Binary file
@@ -3634,3 +3634,29 @@ Migrating to CreatePlanFeatures (20151220161817)
3634
3634
   (3.3ms) INSERT INTO "schema_migrations" (version) VALUES ('20150102001930')
3635
3635
   (1.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20151220161809')
3636
3636
  ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
3637
+ ActiveRecord::SchemaMigration Load (1.3ms) SELECT "schema_migrations".* FROM "schema_migrations"
3638
+  (3.3ms) CREATE TABLE "features" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "description" varchar, "feature_type" varchar, "unit" varchar, "display_order" integer, "use_unit" boolean, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
3639
+  (1.7ms) CREATE TABLE "plan_features" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "value" varchar, "display_value" varchar, "plan_id" integer, "feature_id" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
3640
+  (1.8ms) CREATE TABLE "plans" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "stripe_id" varchar, "name" varchar, "price_cents" integer, "interval" varchar, "interval_count" integer, "trial_period_days" integer, "metadata_as_json" text, "statement_descriptor" text, "highlight" boolean, "display_order" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
3641
+  (1.7ms) CREATE TABLE "subscriptions" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "stripe_id" varchar, "plan_id" integer, "last_four" varchar, "card_type" varchar, "current_price_cents" integer, "user_id" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
3642
+  (1.9ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar DEFAULT '' NOT NULL, "encrypted_password" varchar DEFAULT '' NOT NULL, "reset_password_token" varchar, "reset_password_sent_at" datetime, "remember_created_at" datetime, "sign_in_count" integer DEFAULT 0 NOT NULL, "current_sign_in_at" datetime, "last_sign_in_at" datetime, "current_sign_in_ip" varchar, "last_sign_in_ip" varchar, "created_at" datetime, "updated_at" datetime) 
3643
+  (1.6ms) select sqlite_version(*)
3644
+  (1.9ms) CREATE UNIQUE INDEX "index_users_on_email" ON "users" ("email")
3645
+  (0.1ms) SELECT sql
3646
+ FROM sqlite_master
3647
+ WHERE name='index_users_on_email' AND type='index'
3648
+ UNION ALL
3649
+ SELECT sql
3650
+ FROM sqlite_temp_master
3651
+ WHERE name='index_users_on_email' AND type='index'
3652
+
3653
+  (1.9ms) CREATE UNIQUE INDEX "index_users_on_reset_password_token" ON "users" ("reset_password_token")
3654
+  (1.8ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL)
3655
+  (1.3ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
3656
+  (0.1ms) SELECT version FROM "schema_migrations"
3657
+  (1.4ms) INSERT INTO "schema_migrations" (version) VALUES ('20151220161817')
3658
+  (1.6ms) INSERT INTO "schema_migrations" (version) VALUES ('20150101233243')
3659
+  (0.6ms) INSERT INTO "schema_migrations" (version) VALUES ('20150102001921')
3660
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20150102001930')
3661
+  (1.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20151220161809')
3662
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stripe_saas
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Sam-Bodden
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-26 00:00:00.000000000 Z
11
+ date: 2016-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails