Skip to content

Instantly share code, notes, and snippets.

@lgs
Created December 19, 2014 15:19
Show Gist options
  • Save lgs/154d98e4a14106dea25c to your computer and use it in GitHub Desktop.
Save lgs/154d98e4a14106dea25c to your computer and use it in GitHub Desktop.
RAILS CONSOLE SESSION:
irb(main):016:0> SubscriptionPlan.create(amount: 1000, interval: "month", stripe_id: "test-plan", name: "Test Plan")
(0.2ms) begin transaction
SubscriptionPlan Exists (0.3ms) SELECT 1 AS one FROM "subscription_plans" WHERE "subscription_plans"."stripe_id" = 'test-plan' LIMIT 1
SQL (0.6ms) INSERT INTO "subscription_plans" ("amount", "interval", "stripe_id", "name", "created_at", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["amount", 1000], ["interval", "month"], ["stripe_id", "test-plan"], ["name", "Test Plan"], ["created_at", "2014-12-19 15:12:03.338728"], ["updated_at", "2014-12-19 15:12:03.338728"]]
(146.6ms) commit transaction
=> #<SubscriptionPlan id: 1, amount: 1000, interval: "month", stripe_id: "test-plan", name: "Test Plan", interval_count: nil, trial_period_days: nil, created_at: "2014-12-19 15:12:03", updated_at: "2014-12-19 15:12:03">
irb(main):017:0>
irb(main):001:0> SubscriptionPlan.first
SubscriptionPlan Load (0.2ms) SELECT "subscription_plans".* FROM "subscription_plans" ORDER BY "subscription_plans"."id" ASC LIMIT 1
=> #<SubscriptionPlan id: 1, amount: 1000, interval: "month", stripe_id: "test-plan", name: "Test Plan", interval_count: nil, trial_period_days: nil, created_at: "2014-12-19 15:12:03", updated_at: "2014-12-19 15:12:03">
irb(main):002:0>
RAILS SERVER LOGS:
Started GET "/sub" for 127.0.0.1 at 2014-12-19 16:17:59 +0100
Processing by PagesController#sub as HTML
SubscriptionPlan Load (0.2ms) SELECT "subscription_plans".* FROM "subscription_plans" WHERE "subscription_plans"."id" IS NULL LIMIT 1
Completed 500 Internal Server Error in 87ms
NoMethodError (undefined method `amount' for nil:NilClass):
app/controllers/pages_controller.rb:25:in `sub'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment