Heroku Not Receiving Seed Data from Rails App - ruby-on-rails

I deployed a Rails App to Heroku and the database migrated fine, except the db/seeds.rb file won't push to Heroku. I've tried running heroku run rake db:seed, as well as all the other solutions suggested online, but nothing is working. Heroku doesn't seem to have access to the seeds.rb file at all.
After running heroku run db:seed, nothing seems to happen of worth:
Running rake db:seed on ⬢ top5application... up, run.1885 (Free)
D, [2017-11-02T05:42:19.665233 #4] DEBUG -- :
ActiveRecord::SchemaMigration Load (1.3ms) SELECT
"schema_migrations".* FROM "schema_migrations"
The Heroku logs also don't seem to contain any useful information:
1d22032e7d7e fwd="69.201.160.131" dyno=web.1 connect=0ms service=17ms status=200 bytes=4542 protocol=https
2017-11-02T05:13:34.409329+00:00 app[web.1]: I, [2017-11-02T05:13:34.409232 #4] INFO -- : [44ea0b33-64d7-4516-90d1-1d22032e7d7e] Started GET "/lists" for 69.201.160.131 at 2017-11-02 05:13:34 +0000
2017-11-02T05:13:34.410736+00:00 app[web.1]: I, [2017-11-02T05:13:34.410667 #4] INFO -- : [44ea0b33-64d7-4516-90d1-1d22032e7d7e] Processing by ListsController#index as HTML
2017-11-02T05:13:34.413696+00:00 app[web.1]: D, [2017-11-02T05:13:34.413601 #4] DEBUG -- : [44ea0b33-64d7-4516-90d1-1d22032e7d7e] [1m[36mList Load (0.9ms)[0m [1m[34mSELECT "lists".* FROM "lists" ORDER BY average_rating DESC[0m
2017-11-02T05:13:34.415282+00:00 app[web.1]: I, [2017-11-02T05:13:34.415205 #4] INFO -- : [44ea0b33-64d7-4516-90d1-1d22032e7d7e] Rendering lists/index.html.erb within layouts/application
2017-11-02T05:13:34.417088+00:00 app[web.1]: D, [2017-11-02T05:13:34.416900 #4] DEBUG -- : [44ea0b33-64d7-4516-90d1-1d22032e7d7e] [1m[36mList Load (0.8ms)[0m [1m[34mSELECT "lists".* FROM "lists" ORDER BY "lists"."created_at" DESC[0m
2017-11-02T05:13:34.418866+00:00 app[web.1]: D, [2017-11-02T05:13:34.418785 #4] DEBUG -- : [44ea0b33-64d7-4516-90d1-1d22032e7d7e] [1m[36mTopic Load (0.7ms)[0m [1m[34mSELECT "topics".* FROM "topics"[0m
2017-11-02T05:13:34.419839+00:00 app[web.1]: I, [2017-11-02T05:13:34.419757 #4] INFO -- : [44ea0b33-64d7-4516-90d1-1d22032e7d7e] Rendered lists/index.html.erb within layouts/application (4.3ms)
2017-11-02T05:13:34.422316+00:00 app[web.1]: D, [2017-11-02T05:13:34.422246 #4] DEBUG -- : [44ea0b33-64d7-4516-90d1-1d22032e7d7e] [1m[36mUser Load (0.9ms)[0m [1m[34mSELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2[0m [["id", 1], ["LIMIT", 1]]
2017-11-02T05:13:34.423714+00:00 app[web.1]: I, [2017-11-02T05:13:34.423652 #4] INFO -- : [44ea0b33-64d7-4516-90d1-1d22032e7d7e] Rendered layouts/_logged_in.erb (0.8ms)
2017-11-02T05:13:34.423973+00:00 app[web.1]: I, [2017-11-02T05:13:34.423915 #4] INFO -- : [44ea0b33-64d7-4516-90d1-1d22032e7d7e] Completed 200 OK in 13ms (Views: 7.0ms | ActiveRecord: 3.3ms)
I'd really appreciate any insight because this is very perplexing.

Related

Unexplained massive number of shopping Carts in Rails database in Production

I built an e-commerce app using Rails 5, postgres and heroku, with a classic shopping Cart using the session object to store the cart_id. Thanks to a warning from heroku, I discovered that the numbers of Carts in my database was increasing in a very weird way. It can be more than 50 per minute; and it's not due to many customers visiting the site, which is quite small for the moment. At other moments, the numbers of rows of the Carts table is stable.
Here is my application controller:
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
around_action :switch_locale
before_action :configure_permitted_parameters, if: :devise_controller?
before_action :current_cart
after_action :store_action
def switch_locale(&action)
locale = params[:locale] || I18n.default_locale
I18n.with_locale(locale, &action)
end
def default_url_options
{ locale: I18n.locale == I18n.default_locale ? nil : I18n.locale }
end
def current_cart
if session[:cart_id]
cart = Cart.find_by_id(session[:cart_id])
if cart == nil
session[:cart_id] = nil
end
if cart.present?
#current_cart = cart
else
session[:cart_id] = nil
end
end
if session[:cart_id] == nil
#current_cart = Cart.create
session[:cart_id] = #current_cart.id
end
end
def store_action
return unless request.get?
if (request.path != "/users/sign_in" &&
request.path != "/users/sign_up" &&
request.path != "/users/password/new" &&
request.path != "/users/password/edit" &&
request.path != "/users/confirmation" &&
request.path != "/users/sign_out" &&
!request.xhr?) # don't store ajax calls
store_location_for(:user, request.fullpath)
end
end
protected
def configure_permitted_parameters
devise_parameter_sanitizer.permit(:sign_up, keys: [:username])
end
end
cart.rb
class Cart < ApplicationRecord
has_many :order_items, dependent: :destroy
has_many :products, through: :order_items
monetize :amount_cents_cents
end
and the Orders controller:
class OrdersController < ApplicationController
before_action :authenticate_user!
def create
#order = Order.new
total = []
#current_cart.order_items.each do |item|
total << item.product.price_cents * item.quantity.to_i
end
#order.amount_cents_cents = total.sum
if #order.amount_cents_cents == 0
Cart.destroy(session[:cart_id])
session[:cart_id] = nil
redirect_to root_path
else
#current_cart.order_items.each do |item|
#order.order_items << item
item.cart_id = nil
end
#user = current_user
#order.user_id = #user.id
#order.save
Cart.destroy(session[:cart_id])
session[:cart_id] = nil
redirect_to order_path(#order)
end
Here are Heroku logs from yesterday :
2021-03-09T16:25:31.994631+00:00 app[web.1]: D, [2021-03-09T16:25:31.994568 #4] DEBUG -- : [bc4f12a5-b503-435a-bd45-eac3c3adc006] Cart Create (1.1ms) INSERT INTO "carts" ("created_at", "updated_at") VALUES ($1, $2) RETURNING "id" [["created_at", "2021-03-09 16:25:31.993019"], ["updated_at", "2021-03-09 16:25:31.993019"]]
2021-03-09T16:25:31.996727+00:00 app[web.1]: D, [2021-03-09T16:25:31.996649 #4] DEBUG -- : [bc4f12a5-b503-435a-bd45-eac3c3adc006] (1.8ms) COMMIT
2021-03-09T16:25:31.998717+00:00 app[web.1]: D, [2021-03-09T16:25:31.998636 #4] DEBUG -- : [bc4f12a5-b503-435a-bd45-eac3c3adc006] OrderItem Load (1.1ms) SELECT "order_items".* FROM "order_items" WHERE "order_items"."cart_id" = $1 [["cart_id", 102580]]
2021-03-09T16:25:31.999401+00:00 app[web.1]: I, [2021-03-09T16:25:31.999343 #4] INFO -- : [bc4f12a5-b503-435a-bd45-eac3c3adc006] Rendering carts/show.html.erb within layouts/application
2021-03-09T16:25:32.000698+00:00 app[web.1]: I, [2021-03-09T16:25:32.000634 #4] INFO -- : [bc4f12a5-b503-435a-bd45-eac3c3adc006] Rendered carts/show.html.erb within layouts/application (1.2ms)
2021-03-09T16:25:32.003572+00:00 app[web.1]: I, [2021-03-09T16:25:32.003492 #4] INFO -- : [bc4f12a5-b503-435a-bd45-eac3c3adc006] Rendered shared/_navbar.html.erb (2.0ms)
2021-03-09T16:25:32.003861+00:00 app[web.1]: I, [2021-03-09T16:25:32.003787 #4] INFO -- : [bc4f12a5-b503-435a-bd45-eac3c3adc006] Rendered shared/_flashes.html.erb (0.1ms)
2021-03-09T16:25:32.004305+00:00 app[web.1]: I, [2021-03-09T16:25:32.004209 #4] INFO -- : [bc4f12a5-b503-435a-bd45-eac3c3adc006] Completed 200 OK in 14ms (Views: 5.0ms | ActiveRecord: 5.0ms)
2021-03-09T16:25:32.006089+00:00 heroku[router]: at=info method=GET path="/en/carts/100155" host=www.bravacoffeeroasters.com request_id=bc4f12a5-b503-435a-bd45-eac3c3adc006 fwd="5.9.108.254" dyno=web.1 connect=0ms service=20ms status=200 bytes=8003 protocol=https
2021-03-09T16:25:39.827045+00:00 app[web.1]: I, [2021-03-09T16:25:39.826944 #4] INFO -- : [794133c6-3a8d-4952-b38b-148dd1c78941] Started GET "/en/carts/100158" for 5.9.108.254 at 2021-03-09 16:25:39 +0000
2021-03-09T16:25:39.828020+00:00 app[web.1]: I, [2021-03-09T16:25:39.827942 #4] INFO -- : [794133c6-3a8d-4952-b38b-148dd1c78941] Processing by CartsController#show as HTML
2021-03-09T16:25:39.828070+00:00 app[web.1]: I, [2021-03-09T16:25:39.828014 #4] INFO -- : [794133c6-3a8d-4952-b38b-148dd1c78941] Parameters: {"locale"=>"en", "id"=>"100158"}
2021-03-09T16:25:39.831671+00:00 app[web.1]: D, [2021-03-09T16:25:39.831585 #4] DEBUG -- : [794133c6-3a8d-4952-b38b-148dd1c78941] (1.2ms) BEGIN
2021-03-09T16:25:39.834022+00:00 app[web.1]: D, [2021-03-09T16:25:39.833931 #4] DEBUG -- : [794133c6-3a8d-4952-b38b-148dd1c78941] Cart Create (1.3ms) INSERT INTO "carts" ("created_at", "updated_at") VALUES ($1, $2) RETURNING "id" [["created_at", "2021-03-09 16:25:39.832057"], ["updated_at", "2021-03-09 16:25:39.832057"]]
2021-03-09T16:25:39.836952+00:00 app[web.1]: D, [2021-03-09T16:25:39.836843 #4] DEBUG -- : [794133c6-3a8d-4952-b38b-148dd1c78941] (2.6ms) COMMIT
2021-03-09T16:25:39.838769+00:00 app[web.1]: D, [2021-03-09T16:25:39.838664 #4] DEBUG -- : [794133c6-3a8d-4952-b38b-148dd1c78941] OrderItem Load (1.1ms) SELECT "order_items".* FROM "order_items" WHERE "order_items"."cart_id" = $1 [["cart_id", 102581]]
2021-03-09T16:25:39.839411+00:00 app[web.1]: I, [2021-03-09T16:25:39.839342 #4] INFO -- : [794133c6-3a8d-4952-b38b-148dd1c78941] Rendering carts/show.html.erb within layouts/application
2021-03-09T16:25:39.840887+00:00 app[web.1]: I, [2021-03-09T16:25:39.840812 #4] INFO -- : [794133c6-3a8d-4952-b38b-148dd1c78941] Rendered carts/show.html.erb within layouts/application (1.4ms)
2021-03-09T16:25:39.843830+00:00 app[web.1]: I, [2021-03-09T16:25:39.843767 #4] INFO -- : [794133c6-3a8d-4952-b38b-148dd1c78941] Rendered shared/_navbar.html.erb (2.0ms)
2021-03-09T16:25:39.844041+00:00 app[web.1]: I, [2021-03-09T16:25:39.843979 #4] INFO -- : [794133c6-3a8d-4952-b38b-148dd1c78941] Rendered shared/_flashes.html.erb (0.1ms)
2021-03-09T16:25:39.844419+00:00 app[web.1]: I, [2021-03-09T16:25:39.844315 #4] INFO -- : [794133c6-3a8d-4952-b38b-148dd1c78941] Completed 200 OK in 16ms (Views: 5.1ms | ActiveRecord: 6.2ms)
2021-03-09T16:25:39.846119+00:00 heroku[router]: at=info method=GET path="/en/carts/100158" host=www.bravacoffeeroasters.com request_id=794133c6-3a8d-4952-b38b-148dd1c78941 fwd="5.9.108.254" dyno=web.1 connect=0ms service=21ms status=200 bytes=8007 protocol=https
2021-03-09T16:25:44.393247+00:00 app[web.1]: I, [2021-03-09T16:25:44.393143 #4] INFO -- : [55da48a9-0088-4a3d-984a-f58f8a81245a] Started GET "/en/carts/100162" for 5.9.108.254 at 2021-03-09 16:25:44 +0000
2021-03-09T16:25:44.394349+00:00 app[web.1]: I, [2021-03-09T16:25:44.394257 #4] INFO -- : [55da48a9-0088-4a3d-984a-f58f8a81245a] Processing by CartsController#show as HTML
2021-03-09T16:25:44.394397+00:00 app[web.1]: I, [2021-03-09T16:25:44.394331 #4] INFO -- : [55da48a9-0088-4a3d-984a-f58f8a81245a] Parameters: {"locale"=>"en", "id"=>"100162"}
2021-03-09T16:25:44.402068+00:00 app[web.1]: D, [2021-03-09T16:25:44.401988 #4] DEBUG -- : [55da48a9-0088-4a3d-984a-f58f8a81245a] (1.0ms) BEGIN
2021-03-09T16:25:44.404434+00:00 app[web.1]: D, [2021-03-09T16:25:44.404308 #4] DEBUG -- : [55da48a9-0088-4a3d-984a-f58f8a81245a] Cart Create (1.2ms) INSERT INTO "carts" ("created_at", "updated_at") VALUES ($1, $2) RETURNING "id" [["created_at", "2021-03-09 16:25:44.402575"], ["updated_at", "2021-03-09 16:25:44.402575"]]
2021-03-09T16:25:44.406742+00:00 app[web.1]: D, [2021-03-09T16:25:44.406662 #4] DEBUG -- : [55da48a9-0088-4a3d-984a-f58f8a81245a] (1.9ms) COMMIT
2021-03-09T16:25:44.408565+00:00 app[web.1]: D, [2021-03-09T16:25:44.408479 #4] DEBUG -- : [55da48a9-0088-4a3d-984a-f58f8a81245a] OrderItem Load (1.0ms) SELECT "order_items".* FROM "order_items" WHERE "order_items"."cart_id" = $1 [["cart_id", 102582]]
2021-03-09T16:25:44.409183+00:00 app[web.1]: I, [2021-03-09T16:25:44.409106 #4] INFO -- : [55da48a9-0088-4a3d-984a-f58f8a81245a] Rendering carts/show.html.erb within layouts/application
2021-03-09T16:25:44.410524+00:00 app[web.1]: I, [2021-03-09T16:25:44.410452 #4] INFO -- : [55da48a9-0088-4a3d-984a-f58f8a81245a] Rendered carts/show.html.erb within layouts/application (1.2ms)
2021-03-09T16:25:44.413558+00:00 app[web.1]: I, [2021-03-09T16:25:44.413470 #4] INFO -- : [55da48a9-0088-4a3d-984a-f58f8a81245a] Rendered shared/_navbar.html.erb (2.0ms)
2021-03-09T16:25:44.413840+00:00 app[web.1]: I, [2021-03-09T16:25:44.413772 #4] INFO -- : [55da48a9-0088-4a3d-984a-f58f8a81245a] Rendered shared/_flashes.html.erb (0.1ms)
2021-03-09T16:25:44.414160+00:00 app[web.1]: I, [2021-03-09T16:25:44.414098 #4] INFO -- : [55da48a9-0088-4a3d-984a-f58f8a81245a] Completed 200 OK in 20ms (Views: 5.1ms | ActiveRecord: 5.2ms)
2021-03-09T16:25:44.416182+00:00 heroku[router]: at=info method=GET path="/en/carts/100162" host=www.bravacoffeeroasters.com request_id=55da48a9-0088-4a3d-984a-f58f8a81245a fwd="5.9.108.254" dyno=web.1 connect=0ms service=25ms status=200 bytes=8001 protocol=https
2021-03-09T16:25:49.749861+00:00 app[web.1]: I, [2021-03-09T16:25:49.749718 #4] INFO -- : [c9f138de-a820-4b0b-b87e-ad2f99f6c9f5] Started GET "/en/carts/100167" for 5.9.108.254 at 2021-03-09 16:25:49 +0000
2021-03-09T16:25:49.751269+00:00 app[web.1]: I, [2021-03-09T16:25:49.751173 #4] INFO -- : [c9f138de-a820-4b0b-b87e-ad2f99f6c9f5] Processing by CartsController#show as HTML
2021-03-09T16:25:49.751359+00:00 app[web.1]: I, [2021-03-09T16:25:49.751277 #4] INFO -- : [c9f138de-a820-4b0b-b87e-ad2f99f6c9f5] Parameters: {"locale"=>"en", "id"=>"100167"}
2021-03-09T16:25:49.754570+00:00 app[web.1]: D, [2021-03-09T16:25:49.754464 #4] DEBUG -- : [c9f138de-a820-4b0b-b87e-ad2f99f6c9f5] (1.1ms) BEGIN
2021-03-09T16:25:49.757801+00:00 app[web.1]: D, [2021-03-09T16:25:49.757693 #4] DEBUG -- : [c9f138de-a820-4b0b-b87e-ad2f99f6c9f5] Cart Create (1.2ms) INSERT INTO "carts" ("created_at", "updated_at") VALUES ($1, $2) RETURNING "id" [["created_at", "2021-03-09 16:25:49.755581"], ["updated_at", "2021-03-09 16:25:49.755581"]]
2021-03-09T16:25:49.760623+00:00 app[web.1]: D, [2021-03-09T16:25:49.760418 #4] DEBUG -- : [c9f138de-a820-4b0b-b87e-ad2f99f6c9f5] (2.2ms) COMMIT
2021-03-09T16:25:49.762818+00:00 app[web.1]: D, [2021-03-09T16:25:49.762617 #4] DEBUG -- : [c9f138de-a820-4b0b-b87e-ad2f99f6c9f5] OrderItem Load (1.1ms) SELECT "order_items".* FROM "order_items" WHERE "order_items"."cart_id" = $1 [["cart_id", 102583]]
2021-03-09T16:25:49.764416+00:00 app[web.1]: I, [2021-03-09T16:25:49.764303 #4] INFO -- : [c9f138de-a820-4b0b-b87e-ad2f99f6c9f5] Rendering carts/show.html.erb within layouts/application
2021-03-09T16:25:49.766505+00:00 app[web.1]: I, [2021-03-09T16:25:49.766423 #4] INFO -- : [c9f138de-a820-4b0b-b87e-ad2f99f6c9f5] Rendered carts/show.html.erb within layouts/application (1.9ms)
2021-03-09T16:25:49.771851+00:00 app[web.1]: I, [2021-03-09T16:25:49.771765 #4] INFO -- : [c9f138de-a820-4b0b-b87e-ad2f99f6c9f5] Rendered shared/_navbar.html.erb (3.8ms)
2021-03-09T16:25:49.772151+00:00 app[web.1]: I, [2021-03-09T16:25:49.772072 #4] INFO -- : [c9f138de-a820-4b0b-b87e-ad2f99f6c9f5] Rendered shared/_flashes.html.erb (0.1ms)
2021-03-09T16:25:49.772669+00:00 app[web.1]: I, [2021-03-09T16:25:49.772589 #4] INFO -- : [c9f138de-a820-4b0b-b87e-ad2f99f6c9f5] Completed 200 OK in 21ms (Views: 8.7ms | ActiveRecord: 5.7ms)
2021-03-09T16:25:49.775098+00:00 heroku[router]: at=info method=GET path="/en/carts/100167" host=www.bravacoffeeroasters.com request_id=c9f138de-a820-4b0b-b87e-ad2f99f6c9f5 fwd="5.9.108.254" dyno=web.1 connect=0ms service=28ms status=200 bytes=8005 protocol=https
2021-03-09T16:25:55.885797+00:00 app[web.1]: I, [2021-03-09T16:25:55.885705 #4] INFO -- : [e2305a65-52be-432a-867f-ac1c0f459e1b] Started GET "/en/carts/100171" for 5.9.108.254 at 2021-03-09 16:25:55 +0000
2021-03-09T16:25:55.886791+00:00 app[web.1]: I, [2021-03-09T16:25:55.886726 #4] INFO -- : [e2305a65-52be-432a-867f-ac1c0f459e1b] Processing by CartsController#show as HTML
2021-03-09T16:25:55.886851+00:00 app[web.1]: I, [2021-03-09T16:25:55.886800 #4] INFO -- : [e2305a65-52be-432a-867f-ac1c0f459e1b] Parameters: {"locale"=>"en", "id"=>"100171"}
2021-03-09T16:25:55.889588+00:00 app[web.1]: D, [2021-03-09T16:25:55.889521 #4] DEBUG -- : [e2305a65-52be-432a-867f-ac1c0f459e1b] (1.0ms) BEGIN
2021-03-09T16:25:55.891685+00:00 app[web.1]: D, [2021-03-09T16:25:55.891611 #4] DEBUG -- : [e2305a65-52be-432a-867f-ac1c0f459e1b] Cart Create (1.2ms) INSERT INTO "carts" ("created_at", "updated_at") VALUES ($1, $2) RETURNING "id" [["created_at", "2021-03-09 16:25:55.889991"], ["updated_at", "2021-03-09 16:25:55.889991"]]
2021-03-09T16:25:55.894147+00:00 app[web.1]: D, [2021-03-09T16:25:55.894080 #4] DEBUG -- : [e2305a65-52be-432a-867f-ac1c0f459e1b] (2.1ms) COMMIT
2021-03-09T16:25:55.895883+00:00 app[web.1]: D, [2021-03-09T16:25:55.895820 #4] DEBUG -- : [e2305a65-52be-432a-867f-ac1c0f459e1b] OrderItem Load (1.1ms) SELECT "order_items".* FROM "order_items" WHERE "order_items"."cart_id" = $1 [["cart_id", 102584]]
2021-03-09T16:25:55.896595+00:00 app[web.1]: I, [2021-03-09T16:25:55.896512 #4] INFO -- : [e2305a65-52be-432a-867f-ac1c0f459e1b] Rendering carts/show.html.erb within layouts/application
2021-03-09T16:25:55.898042+00:00 app[web.1]: I, [2021-03-09T16:25:55.897982 #4] INFO -- : [e2305a65-52be-432a-867f-ac1c0f459e1b] Rendered carts/show.html.erb within layouts/application (1.4ms)
2021-03-09T16:25:55.900969+00:00 app[web.1]: I, [2021-03-09T16:25:55.900906 #4] INFO -- : [e2305a65-52be-432a-867f-ac1c0f459e1b] Rendered shared/_navbar.html.erb (2.0ms)
2021-03-09T16:25:55.901154+00:00 app[web.1]: I, [2021-03-09T16:25:55.901098 #4] INFO -- : [e2305a65-52be-432a-867f-ac1c0f459e1b] Rendered shared/_flashes.html.erb (0.0ms)
2021-03-09T16:25:55.901439+00:00 app[web.1]: I, [2021-03-09T16:25:55.901385 #4] INFO -- : [e2305a65-52be-432a-867f-ac1c0f459e1b] Completed 200 OK in 14ms (Views: 5.1ms | ActiveRecord: 5.3ms)
2021-03-09T16:25:55.903393+00:00 heroku[router]: at=info method=GET path="/en/carts/100171" host=www.bravacoffeeroasters.com request_id=e2305a65-52be-432a-867f-ac1c0f459e1b fwd="5.9.108.254" dyno=web.1 connect=0ms service=20ms status=200 bytes=8005 protocol=https
2021-03-09T16:26:02.095206+00:00 app[web.1]: I, [2021-03-09T16:26:02.095107 #4] INFO -- : [59ebb736-4614-4052-97dd-9517cfd2af70] Started GET "/en/carts/100176" for 5.9.108.254 at 2021-03-09 16:26:02 +0000
2021-03-09T16:26:02.096223+00:00 app[web.1]: I, [2021-03-09T16:26:02.096121 #4] INFO -- : [59ebb736-4614-4052-97dd-9517cfd2af70] Processing by CartsController#show as HTML
2021-03-09T16:26:02.096287+00:00 app[web.1]: I, [2021-03-09T16:26:02.096209 #4] INFO -- : [59ebb736-4614-4052-97dd-9517cfd2af70] Parameters: {"locale"=>"en", "id"=>"100176"}
2021-03-09T16:26:02.099292+00:00 app[web.1]: D, [2021-03-09T16:26:02.099195 #4] DEBUG -- : [59ebb736-4614-4052-97dd-9517cfd2af70] (1.0ms) BEGIN
2021-03-09T16:26:02.101864+00:00 app[web.1]: D, [2021-03-09T16:26:02.101787 #4] DEBUG -- : [59ebb736-4614-4052-97dd-9517cfd2af70] Cart Create (1.3ms) INSERT INTO "carts" ("created_at", "updated_at") VALUES ($1, $2) RETURNING "id" [["created_at", "2021-03-09 16:26:02.099815"], ["updated_at", "2021-03-09 16:26:02.099815"]]
2021-03-09T16:26:02.104590+00:00 app[web.1]: D, [2021-03-09T16:26:02.104462 #4] DEBUG -- : [59ebb736-4614-4052-97dd-9517cfd2af70] (2.3ms) COMMIT
2021-03-09T16:26:02.106692+00:00 app[web.1]: D, [2021-03-09T16:26:02.106619 #4] DEBUG -- : [59ebb736-4614-4052-97dd-9517cfd2af70] OrderItem Load (1.3ms) SELECT "order_items".* FROM "order_items" WHERE "order_items"."cart_id" = $1 [["cart_id", 102585]]
2021-03-09T16:26:02.107212+00:00 app[web.1]: I, [2021-03-09T16:26:02.107150 #4] INFO -- : [59ebb736-4614-4052-97dd-9517cfd2af70] Rendering carts/show.html.erb within layouts/application
2021-03-09T16:26:02.108495+00:00 app[web.1]: I, [2021-03-09T16:26:02.108422 #4] INFO -- : [59ebb736-4614-4052-97dd-9517cfd2af70] Rendered carts/show.html.erb within layouts/application (1.2ms)
2021-03-09T16:26:02.111100+00:00 app[web.1]: I, [2021-03-09T16:26:02.111034 #4] INFO -- : [59ebb736-4614-4052-97dd-9517cfd2af70] Rendered shared/_navbar.html.erb (1.7ms)
2021-03-09T16:26:02.111294+00:00 app[web.1]: I, [2021-03-09T16:26:02.111230 #4] INFO -- : [59ebb736-4614-4052-97dd-9517cfd2af70] Rendered shared/_flashes.html.erb (0.1ms)
2021-03-09T16:26:02.111695+00:00 app[web.1]: I, [2021-03-09T16:26:02.111563 #4] INFO -- : [59ebb736-4614-4052-97dd-9517cfd2af70] Completed 200 OK in 15ms (Views: 4.5ms | ActiveRecord: 5.9ms)
2021-03-09T16:26:02.114053+00:00 heroku[router]: at=info method=GET path="/en/carts/100176" host=www.bravacoffeeroasters.com request_id=59ebb736-4614-4052-97dd-9517cfd2af70 fwd="5.9.108.254" dyno=web.1 connect=0ms service=21ms status=200 bytes=8011 protocol=https
2021-03-09T16:26:07.168587+00:00 app[web.1]: I, [2021-03-09T16:26:07.168395 #4] INFO -- : [512ac9cd-da40-435d-a7b8-986ad4209a31] Started GET "/en/carts/100181" for 5.9.108.254 at 2021-03-09 16:26:07 +0000
2021-03-09T16:26:07.169524+00:00 app[web.1]: I, [2021-03-09T16:26:07.169461 #4] INFO -- : [512ac9cd-da40-435d-a7b8-986ad4209a31] Processing by CartsController#show as HTML
2021-03-09T16:26:07.169585+00:00 app[web.1]: I, [2021-03-09T16:26:07.169533 #4] INFO -- : [512ac9cd-da40-435d-a7b8-986ad4209a31] Parameters: {"locale"=>"en", "id"=>"100181"}
2021-03-09T16:26:07.172559+00:00 app[web.1]: D, [2021-03-09T16:26:07.172490 #4] DEBUG -- : [512ac9cd-da40-435d-a7b8-986ad4209a31] (1.0ms) BEGIN
2021-03-09T16:26:07.174639+00:00 app[web.1]: D, [2021-03-09T16:26:07.174577 #4] DEBUG -- : [512ac9cd-da40-435d-a7b8-986ad4209a31] Cart Create (1.2ms) INSERT INTO "carts" ("created_at", "updated_at") VALUES ($1, $2) RETURNING "id" [["created_at", "2021-03-09 16:26:07.172954"], ["updated_at", "2021-03-09 16:26:07.172954"]]
2021-03-09T16:26:07.176801+00:00 app[web.1]: D, [2021-03-09T16:26:07.176731 #4] DEBUG -- : [512ac9cd-da40-435d-a7b8-986ad4209a31] (1.9ms) COMMIT
2021-03-09T16:26:07.178631+00:00 app[web.1]: D, [2021-03-09T16:26:07.178567 #4] DEBUG -- : [512ac9cd-da40-435d-a7b8-986ad4209a31] OrderItem Load (1.1ms) SELECT "order_items".* FROM "order_items" WHERE "order_items"."cart_id" = $1 [["cart_id", 102586]]
2021-03-09T16:26:07.179179+00:00 app[web.1]: I, [2021-03-09T16:26:07.179119 #4] INFO -- : [512ac9cd-da40-435d-a7b8-986ad4209a31] Rendering carts/show.html.erb within layouts/application
2021-03-09T16:26:07.180626+00:00 app[web.1]: I, [2021-03-09T16:26:07.180554 #4] INFO -- : [512ac9cd-da40-435d-a7b8-986ad4209a31] Rendered carts/show.html.erb within layouts/application (1.3ms)
2021-03-09T16:26:07.183396+00:00 app[web.1]: I, [2021-03-09T16:26:07.183332 #4] INFO -- : [512ac9cd-da40-435d-a7b8-986ad4209a31] Rendered shared/_navbar.html.erb (1.9ms)
2021-03-09T16:26:07.183592+00:00 app[web.1]: I, [2021-03-09T16:26:07.183524 #4] INFO -- : [512ac9cd-da40-435d-a7b8-986ad4209a31] Rendered shared/_flashes.html.erb (0.0ms)
2021-03-09T16:26:07.183924+00:00 app[web.1]: I, [2021-03-09T16:26:07.183852 #4] INFO -- : [512ac9cd-da40-435d-a7b8-986ad4209a31] Completed 200 OK in 14ms (Views: 4.8ms | ActiveRecord: 5.1ms)
2021-03-09T16:26:07.186556+00:00 heroku[router]: at=info method=GET path="/en/carts/100181" host=www.bravacoffeeroasters.com request_id=512ac9cd-da40-435d-a7b8-986ad4209a31 fwd="5.9.108.254" dyno=web.1 connect=0ms service=20ms status=200 bytes=8009 protocol=https
2021-03-09T16:26:12.791059+00:00 app[web.1]: I, [2021-03-09T16:26:12.790956 #4] INFO -- : [ee78de9f-ffb9-4c3b-a484-8438903fd9c9] Started GET "/en/carts/100185" for 5.9.108.254 at 2021-03-09 16:26:12 +0000
2021-03-09T16:26:12.792005+00:00 app[web.1]: I, [2021-03-09T16:26:12.791938 #4] INFO -- : [ee78de9f-ffb9-4c3b-a484-8438903fd9c9] Processing by CartsController#show as HTML
2021-03-09T16:26:12.792075+00:00 app[web.1]: I, [2021-03-09T16:26:12.792011 #4] INFO -- : [ee78de9f-ffb9-4c3b-a484-8438903fd9c9] Parameters: {"locale"=>"en", "id"=>"100185"}
2021-03-09T16:26:12.794860+00:00 app[web.1]: D, [2021-03-09T16:26:12.794781 #4] DEBUG -- : [ee78de9f-ffb9-4c3b-a484-8438903fd9c9] (1.0ms) BEGIN
2021-03-09T16:26:12.797433+00:00 app[web.1]: D, [2021-03-09T16:26:12.797358 #4] DEBUG -- : [ee78de9f-ffb9-4c3b-a484-8438903fd9c9] Cart Create (1.2ms) INSERT INTO "carts" ("created_at", "updated_at") VALUES ($1, $2) RETURNING "id" [["created_at", "2021-03-09 16:26:12.795289"], ["updated_at", "2021-03-09 16:26:12.795289"]]
2021-03-09T16:26:12.799742+00:00 app[web.1]: D, [2021-03-09T16:26:12.799657 #4] DEBUG -- : [ee78de9f-ffb9-4c3b-a484-8438903fd9c9] (1.8ms) COMMIT
2021-03-09T16:26:12.801691+00:00 app[web.1]: D, [2021-03-09T16:26:12.801618 #4] DEBUG -- : [ee78de9f-ffb9-4c3b-a484-8438903fd9c9] OrderItem Load (1.2ms) SELECT "order_items".* FROM "order_items" WHERE "order_items"."cart_id" = $1 [["cart_id", 102587]]
2021-03-09T16:26:12.802222+00:00 app[web.1]: I, [2021-03-09T16:26:12.802153 #4] INFO -- : [ee78de9f-ffb9-4c3b-a484-8438903fd9c9] Rendering carts/show.html.erb within layouts/application
2021-03-09T16:26:12.803798+00:00 app[web.1]: I, [2021-03-09T16:26:12.803727 #4] INFO -- : [ee78de9f-ffb9-4c3b-a484-8438903fd9c9] Rendered carts/show.html.erb within layouts/application (1.5ms)
2021-03-09T16:26:12.807236+00:00 app[web.1]: I, [2021-03-09T16:26:12.807070 #4] INFO -- : [ee78de9f-ffb9-4c3b-a484-8438903fd9c9] Rendered shared/_navbar.html.erb (2.3ms)
2021-03-09T16:26:12.807516+00:00 app[web.1]: I, [2021-03-09T16:26:12.807446 #4] INFO -- : [ee78de9f-ffb9-4c3b-a484-8438903fd9c9] Rendered shared/_flashes.html.erb (0.1ms)
2021-03-09T16:26:12.807908+00:00 app[web.1]: I, [2021-03-09T16:26:12.807840 #4] INFO -- : [ee78de9f-ffb9-4c3b-a484-8438903fd9c9] Completed 200 OK in 16ms (Views: 5.8ms | ActiveRecord: 5.2ms)
2021-03-09T16:26:12.809202+00:00 heroku[router]: at=info method=GET path="/en/carts/100185" host=www.bravacoffeeroasters.com request_id=ee78de9f-ffb9-4c3b-a484-8438903fd9c9 fwd="5.9.108.254" dyno=web.1 connect=0ms service=20ms status=200 bytes=8013 protocol=https
I deleted all the Carts of the production database yesterday and today I have already more than 3000 rows. This sounds bad to me. Is anyone could help fixing the problem?
If I am reading your code correctly:
before_action :current_cart
def current_cart
...
if session[:cart_id] == nil
#current_cart = Cart.create
session[:cart_id] = #current_cart.id
end
end
A before_action added in ApplicationController will execute for every action in every controller that inherits from ApplicationController.
Even your homepage probably executes it. When session[:cart_id] is nil (which by your current issue, it happens a lot) every access will create a Cart.
The purpose of current_cart, IMO, same as current_user is to find a cart not create one. If it's not present, then it's other action's purpose to create it.
You should revise your logic a little. Good luck!

500 error after pushing to heroku - DEBUG

Im having an openuri issue when in production. The code below works in development but when in production the unauthorized error comes up. The only way i've solved this is if i put the api key directly in the url, which obviously i dont want to do. Any ideas why my current code doesnt work?
api_key = ENV["NEWS_API"]
url = "https://newsapi.org/v2/top-headlines?sources=techcrunch&apiKey=#{api_key}"
article_serialized = open(url).read
#articles = JSON.parse(article_serialized)
2018-10-25T01:55:47.184856+00:00 app[web.1]: F, [2018-10-25T01:55:47.184804 #4] FATAL -- : [40a7ee38-ef6e-4622-ad86-edb34d7eeccf] OpenURI::HTTPError (401 Unauthorized):
Running rails db:migrate on ⬢ twittter-clone... up, run.6483 (Free)
D, [2018-10-25T01:12:44.387465 #4] DEBUG -- : (0.9ms) SELECT pg_try_advisory_lock(2661719123600558280)
D, [2018-10-25T01:12:44.433095 #4] DEBUG -- : (2.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
D, [2018-10-25T01:12:44.456835 #4] DEBUG -- : ActiveRecord::InternalMetadata Load (3.8ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]
D, [2018-10-25T01:12:44.480937 #4] DEBUG -- : (5.3ms) BEGIN
D, [2018-10-25T01:12:44.485057 #4] DEBUG -- : (1.7ms) COMMIT
D, [2018-10-25T01:12:44.492822 #4] DEBUG -- : (7.1ms) SELECT pg_advisory_unlock(2661719123600558280)
OpenURI returns a 401 error and my guess is that the ENV['NEWS_API'] is not set. You can run heroku config in the terminal or look it up on the web interface: Settings -> Reveal Config Vars

NoMethodError (undefined method `connect_timeout=' for #<Typhoeus::Request:0x000000000782ded8>):

I am trying to implement Log-In with Facebook to my app. Everything worked fine in development but for production I had to upgrade the app to https and when I pushed to production, nothing works anymore.
I have no idea how to debug this since it's in production. Any help would be appreciated.
Those are the server logs:
2018-09-17T19:07:21.708757+00:00 app[web.1]: I, [2018-09-17T19:07:21.708637 #4] INFO -- : [c8077522-7674-46e5-97b8-c74456194630] Started GET "/users/auth/facebook" for 213.190.86.42 at 2018-09-17 19:07:21 +0000
2018-09-17T19:07:21.709189+00:00 app[web.1]: I, [2018-09-17T19:07:21.709128 #4] INFO -- omniauth: (facebook) Request phase initiated.
2018-09-17T19:07:22.442651+00:00 app[web.1]: I, [2018-09-17T19:07:22.442540 #4] INFO -- : [3d25cc49-e2ec-4593-bf2f-d06d5595cd78] Started GET "/users/auth/facebook/callback?code=AQDCk0zcgI3_D0ZEuO5l6pWjAbhRgSelpfYcPB_f70hwffFdhs2MRp1rYd1fktORGUhqruLXbB40DXbbbx71zMHD2hH5UyndDQXbWpZ4gIoDuGVqO6IgFMwQuv0Jp_-PVQ2eokb_aW_ZfVY_LkIYPUWqy4fGihmWgd3S4cSlpo9zqV_0m9Ra4avOXQjw5a8VQEq2WNlIsun4J77x4EBzrOh_9xtVG582YV2pZy6tFE83QsvsmNkpBEzmWsV0bnGek94hbnbkpKRmImHfCLD5iyJ3HWZ3uQLG3FypdGZHjo8BtQ23Y2GeD5lnsyGlvqGRX4M&state=f58628a503514d6fd368e47a88f0f1c383e1dbe519b4ad09" for 213.190.86.42 at 2018-09-17 19:07:22 +0000
2018-09-17T19:07:22.443281+00:00 app[web.1]: I, [2018-09-17T19:07:22.443215 #4] INFO -- omniauth: (facebook) Callback phase initiated.
2018-09-17T19:07:22.958420+00:00 app[web.1]: I, [2018-09-17T19:07:22.958291 #4] INFO -- : [3d25cc49-e2ec-4593-bf2f-d06d5595cd78] Processing by Users::OmniauthCallbacksController#facebook as HTML
2018-09-17T19:07:22.963677+00:00 app[web.1]: I, [2018-09-17T19:07:22.962975 #4] INFO -- : [3d25cc49-e2ec-4593-bf2f-d06d5595cd78] Parameters: {"code"=>"AQDCk0zcgI3_D0ZEuO5l6pWjAbhRgSelpfYcPB_f70hwffFdhs2MRp1rYd1fktORGUhqruLXbB40DXbbbx71zMHD2hH5UyndDQXbWpZ4gIoDuGVqO6IgFMwQuv0Jp_-PVQ2eokb_aW_ZfVY_LkIYPUWqy4fGihmWgd3S4cSlpo9zqV_0m9Ra4avOXQjw5a8VQEq2WNlIsun4J77x4EBzrOh_9xtVG582YV2pZy6tFE83QsvsmNkpBEzmWsV0bnGek94hbnbkpKRmImHfCLD5iyJ3HWZ3uQLG3FypdGZHjo8BtQ23Y2GeD5lnsyGlvqGRX4M", "state"=>"f58628a503514d6fd368e47a88f0f1c383e1dbe519b4ad09"}
2018-09-17T19:07:22.987503+00:00 app[web.1]: D, [2018-09-17T19:07:22.987389 #4] DEBUG -- : [3d25cc49-e2ec-4593-bf2f-d06d5595cd78] User Load (3.9ms) SELECT "users".* FROM "users" WHERE "users"."provider" = $1 AND "users"."uid" = $2 LIMIT $3 [["provider", "facebook"], ["uid", "10156065770667984"], ["LIMIT", 1]]
2018-09-17T19:07:22.990121+00:00 app[web.1]: D, [2018-09-17T19:07:22.990015 #4] DEBUG -- : [3d25cc49-e2ec-4593-bf2f-d06d5595cd78] (1.6ms) BEGIN
2018-09-17T19:07:22.997442+00:00 app[web.1]: D, [2018-09-17T19:07:22.997336 #4] DEBUG -- : [3d25cc49-e2ec-4593-bf2f-d06d5595cd78] User Exists (2.1ms) SELECT 1 AS one FROM "users" WHERE "users"."username" = $1 AND "users"."id" != $2 LIMIT $3 [["username", "Listy"], ["id", 65], ["LIMIT", 1]]
2018-09-17T19:07:23.002441+00:00 app[web.1]: D, [2018-09-17T19:07:23.002365 #4] DEBUG -- : [3d25cc49-e2ec-4593-bf2f-d06d5595cd78] User Update (2.9ms) UPDATE "users" SET "token" = $1, "token_expiry" = $2, "updated_at" = $3 WHERE "users"."id" = $4 [["token", "EAADxC9YDD2sBAKeTKx0Cgp86Dnm5l774a2vVsZBYwOTnl7TV9egMgBYjTtgY9lFHV6eW90V1KgRspbcHM3mKL92hKPO0fZAVbkNaWjdHzJ8TQiaRYJqZC3NnhNu6GOOr6eFtteA48XWhYXQslchLmFgUky1G50ZD"], ["token_expiry", "2018-11-16 19:07:22"], ["updated_at", "2018-09-17 19:07:22.997902"], ["id", 65]]
2018-09-17T19:07:23.055468+00:00 app[web.1]: D, [2018-09-17T19:07:23.055339 #4] DEBUG -- : [3d25cc49-e2ec-4593-bf2f-d06d5595cd78] (6.5ms) COMMIT
2018-09-17T19:07:23.063263+00:00 app[web.1]: I, [2018-09-17T19:07:23.063174 #4] INFO -- : [3d25cc49-e2ec-4593-bf2f-d06d5595cd78] Completed 500 Internal Server Error in 99ms (Searchkick: 6.4ms | ActiveRecord: 19.1ms)
2018-09-17T19:07:23.064786+00:00 app[web.1]: F, [2018-09-17T19:07:23.064718 #4] FATAL -- : [3d25cc49-e2ec-4593-bf2f-d06d5595cd78]
2018-09-17T19:07:23.062638+00:00 app[web.1]: D, [2018-09-17T19:07:23.062529 #4] DEBUG -- : [3d25cc49-e2ec-4593-bf2f-d06d5595cd78] User Store (6.4ms) {"id":65,"exception":["NoMethodError","undefined method `connect_timeout=' for #\u003cTyphoeus::Request:0x000000000782ded8\u003e"],"exception_object":"undefined method `connect_timeout=' for #\u003cTyphoeus::Request:0x000000000782ded8\u003e"}
2018-09-17T19:07:23.065029+00:00 app[web.1]: F, [2018-09-17T19:07:23.064965 #4] FATAL -- : [3d25cc49-e2ec-4593-bf2f-d06d5595cd78] NoMethodError (undefined method `connect_timeout=' for #<Typhoeus::Request:0x000000000782ded8>):
2018-09-17T19:07:23.065153+00:00 app[web.1]: F, [2018-09-17T19:07:23.065087 #4] FATAL -- : [3d25cc49-e2ec-4593-bf2f-d06d5595cd78]
2018-09-17T19:07:23.065246+00:00 app[web.1]: [3d25cc49-e2ec-4593-bf2f-d06d5595cd78] app/controllers/users/omniauth_callbacks_controller.rb:3:in `facebook'
2018-09-17T19:07:23.065243+00:00 app[web.1]: F, [2018-09-17T19:07:23.065187 #4] FATAL -- : [3d25cc49-e2ec-4593-bf2f-d06d5595cd78] app/models/user.rb:76:in `find_for_facebook_oauth'
2018-09-17T19:07:23.067245+00:00 heroku[router]: at=info method=GET path= "/users/auth/facebook/callback?code= AQDCk0zcgI3_D0ZEuO5l6pWjAbhRgSelpfYcPB_f70hwffFdhs2MRp1rYd1fktORGUhqruLXbB40DXbbbx71zMHD2hH5UyndDQXbWpZ4gIoDuGVqO6IgFMwQuv0Jp_-PVQ2eokb_aW_ZfVY_LkIYPUWqy4fGihmWgd3S4cSlpo9zqV_0m9Ra4avOXQjw5a8VQEq2WNlIsun4J77x4EBzrOh_9xtVG582YV2pZy6tFE83QsvsmNkpBEzmWsV0bnGek94hbnbkpKRmImHfCLD5iyJ3HWZ3uQLG3FypdGZHjo8BtQ23Y2GeD5lnsyGlvqGRX4M&state=f58628a503514d6fd368e47a88f0f1c383e1dbe519b4ad09" host=www.listy.club request_id=3d25cc49-e2ec-4593-bf2f-d06d5595cd78 fwd="213.190.86.42" dyno=web.1 connect=0ms service=630ms status=500 bytes=1891 protocol=https
2018-09-17T19:08:50.249219+00:00 heroku[run.8341]: Process exited with status 0

Why is this object undefined? Ruby, Rails, Gmail error

I can't seem to figure out why I am getting the error :
2017-01-03T02:57:35.239505+00:00 app[web.1]: I, [2017-01-03T02:57:35.239437 #4] INFO -- : [89b504ee-5835-4bfa-a3ff-91a3a84549f6] Parameters: {"id"=>"3"}
2017-01-03T02:57:35.243975+00:00 app[web.1]: D, [2017-01-03T02:57:35.243890 #4] DEBUG -- : [89b504ee-5835-4bfa-a3ff-91a3a84549f6] User Load (1.5ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2 [["id", 22], ["LIMIT", 1]]
2017-01-03T02:57:35.468562+00:00 app[web.1]: true
2017-01-03T02:57:35.476648+00:00 app[web.1]: D, [2017-01-03T02:57:35.476563 #4] DEBUG -- : [89b504ee-5835-4bfa-a3ff-91a3a84549f6] Blueprint Load (2.7ms) SELECT "blueprints".* FROM "blueprints" WHERE "blueprints"."id" = $1 LIMIT $2 [["id", 3], ["LIMIT", 1]]
2017-01-03T02:57:35.477654+00:00 app[web.1]: I, [2017-01-03T02:57:35.477582 #4] INFO -- : [89b504ee-5835-4bfa-a3ff-91a3a84549f6] Completed 500 Internal Server Error in 238ms (ActiveRecord: 5.5ms)
2017-01-03T02:57:35.478257+00:00 app[web.1]: F, [2017-01-03T02:57:35.478177 #4] FATAL -- : [89b504ee-5835-4bfa-a3ff-91a3a84549f6]
2017-01-03T02:57:35.478313+00:00 app[web.1]: F, [2017-01-03T02:57:35.478256 #4] FATAL -- : [89b504ee-5835-4bfa-a3ff-91a3a84549f6] Gmail::Client::DeliveryError (Couldn't deliver email: undefined method `subject' for nil:NilClass):
For some reason the object #current_blueprint doesn't seem to be working inside of the gmail.deliver block. Am I missing something obvious?
Appreciate any help. Thanks!
#current_blueprint = Blueprint.find(params[:id])
mail_status = gmail.deliver! do
to "email#gmail.com"
subject #current_blueprint.subject
html_part do
content_type 'text/html; charset=UTF-8'
body #current_blueprint.body
end
end
puts mail_status
Try just current_blueprint without the # sign.
Sometime a library executes a do end with a different self and can thus not access instance variables, but it should be able to access local variables that are in scope.
Just guessing, let me know whether it works.

Rails/Angular app works perfectly locally but I'm getting a 500 Server Error on Heroku

I have a nice little rails angular app that is working great locally, but now that I am trying to deploy to heroku, I'm having some problems. Namely, when I try making a POST request (through ajax), I get back and internal server error as a response({"status":"500","error":"Internal Server Error"}). It's really driving me crazy, it seems that it's preventing the info I want to get into my database from getting there, I've tried doing the suggestions on some of the other SO threads and nothing seems to work. Doubly confusing because it works perfectly on the local host. The heroku logs for the event are here:
2014-09-23T04:30:37.497826+00:00 app[web.1]: => Booting WEBrick
2014-09-23T04:30:37.497831+00:00 app[web.1]: => Rails 4.1.4 application starting in production on http://0.0.0.0:9878
2014-09-23T04:30:37.497833+00:00 app[web.1]: => Run `rails server -h` for more startup options
2014-09-23T04:30:37.497835+00:00 app[web.1]: => Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
2014-09-23T04:30:37.497836+00:00 app[web.1]: => Ctrl-C to shutdown server
2014-09-23T04:30:37.497838+00:00 app[web.1]: I, [2014-09-23T04:27:51.885672 #2] INFO -- : Started GET "/" for 184.73.44.87 at 2014-09-23 04:27:51 +0000
2014-09-23T04:30:37.497840+00:00 app[web.1]: I, [2014-09-23T04:27:51.988811 #2] INFO -- : Processing by PagesController#index as */*
2014-09-23T04:30:37.497841+00:00 app[web.1]: I, [2014-09-23T04:27:52.039041 #2] INFO -- : Redirected to http://hidden-lowlands-5596.herokuapp.com/users/sign_in
2014-09-23T04:30:37.497843+00:00 app[web.1]: I, [2014-09-23T04:27:52.039888 #2] INFO -- : Completed 302 Found in 51ms (ActiveRecord: 0.0ms)
2014-09-23T04:30:37.497845+00:00 app[web.1]: I, [2014-09-23T04:27:52.072805 #2] INFO -- : Started GET "/users/sign_in" for 184.73.44.87 at 2014-09-23 04:27:52 +0000
2014-09-23T04:30:37.497846+00:00 app[web.1]: I, [2014-09-23T04:27:52.077594 #2] INFO -- : Processing by Devise::SessionsController#new as */*
2014-09-23T04:30:37.497848+00:00 app[web.1]: I, [2014-09-23T04:27:52.128662 #2] INFO -- : Rendered devise/sessions/new.html.erb within layouts/application (14.9ms)
2014-09-23T04:30:37.497849+00:00 app[web.1]: I, [2014-09-23T04:27:52.180470 #2] INFO -- : Completed 200 OK in 103ms (Views: 70.2ms | ActiveRecord: 13.0ms)
2014-09-23T04:30:37.497851+00:00 app[web.1]: I, [2014-09-23T04:29:23.691686 #2] INFO -- : Started GET "/" for 24.6.253.209 at 2014-09-23 04:29:23 +0000
2014-09-23T04:30:37.497852+00:00 app[web.1]: I, [2014-09-23T04:29:23.695622 #2] INFO -- : Processing by PagesController#index as HTML
2014-09-23T04:30:37.497854+00:00 app[web.1]: D, [2014-09-23T04:29:23.701573 #2] DEBUG -- : User Load (2.4ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 ORDER BY "users"."id" ASC LIMIT 1
2014-09-23T04:30:37.497855+00:00 app[web.1]: I, [2014-09-23T04:29:23.706305 #2] INFO -- : Rendered pages/index.html within layouts/application (1.3ms)
2014-09-23T04:30:37.497857+00:00 app[web.1]: I, [2014-09-23T04:29:23.707351 #2] INFO -- : Completed 200 OK in 12ms (Views: 5.0ms | ActiveRecord: 2.4ms)
2014-09-23T04:30:37.497858+00:00 app[web.1]: I, [2014-09-23T04:29:25.125810 #2] INFO -- : Started GET "/articles" for 24.6.253.209 at 2014-09-23 04:29:25 +0000
2014-09-23T04:30:37.497860+00:00 app[web.1]: I, [2014-09-23T04:29:25.130961 #2] INFO -- : Processing by ArticlesController#index as JSON
2014-09-23T04:30:37.497863+00:00 app[web.1]: D, [2014-09-23T04:29:25.133835 #2] DEBUG -- : User Load (1.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 ORDER BY "users"."id" ASC LIMIT 1
2014-09-23T04:30:37.497864+00:00 app[web.1]: D, [2014-09-23T04:29:25.159063 #2] DEBUG -- : Feed Load (1.8ms) SELECT "feeds".* FROM "feeds" INNER JOIN "subscriptions" ON "feeds"."id" = "subscriptions"."feed_id" WHERE "subscriptions"."user_id" = $1 [["user_id", 1]]
2014-09-23T04:30:37.523076+00:00 heroku[router]: at=info method=GET path="/feeds" host=hidden-lowlands-5596.herokuapp.com request_id=f4e81159-eb5a-4115-9f35-3f666527d781 fwd="24.6.253.209" dyno=web.1 connect=1ms service=35ms status=304 bytes=1028
2014-09-23T04:30:37.497865+00:00 app[web.1]: D, [2014-09-23T04:29:25.179293 #2] DEBUG -- : Article Load (1.2ms) SELECT "articles".* FROM "articles" WHERE "articles"."feed_id" = $1 [["feed_id", 10]]
2014-09-23T04:30:37.497867+00:00 app[web.1]: D, [2014-09-23T04:29:25.184538 #2] DEBUG -- : Article Load (4.7ms) SELECT "articles".* FROM "articles" WHERE "articles"."feed_id" = $1 [["feed_id", 11]]
2014-09-23T04:30:37.497869+00:00 app[web.1]: D, [2014-09-23T04:29:25.186052 #2] DEBUG -- : Article Load (1.1ms) SELECT "articles".* FROM "articles" WHERE "articles"."feed_id" = $1 [["feed_id", 12]]
2014-09-23T04:30:37.497878+00:00 app[web.1]: D, [2014-09-23T04:29:25.187533 #2] DEBUG -- : Article Load (1.1ms) SELECT "articles".* FROM "articles" WHERE "articles"."feed_id" = $1 [["feed_id", 13]]
2014-09-23T04:30:37.497879+00:00 app[web.1]: D, [2014-09-23T04:29:25.188925 #2] DEBUG -- : Article Load (1.0ms) SELECT "articles".* FROM "articles" WHERE "articles"."feed_id" = $1 [["feed_id", 14]]
2014-09-23T04:30:37.497881+00:00 app[web.1]: D, [2014-09-23T04:29:25.190294 #2] DEBUG -- : Article Load (1.0ms) SELECT "articles".* FROM "articles" WHERE "articles"."feed_id" = $1 [["feed_id", 15]]
2014-09-23T04:30:37.497882+00:00 app[web.1]: D, [2014-09-23T04:29:25.192010 #2] DEBUG -- : Article Load (1.3ms) SELECT "articles".* FROM "articles" WHERE "articles"."feed_id" = $1 [["feed_id", 16]]
2014-09-23T04:30:37.497884+00:00 app[web.1]: D, [2014-09-23T04:29:25.193307 #2] DEBUG -- : Article Load (0.9ms) SELECT "articles".* FROM "articles" WHERE "articles"."feed_id" = $1 [["feed_id", 17]]
2014-09-23T04:30:37.497885+00:00 app[web.1]: D, [2014-09-23T04:29:25.194673 #2] DEBUG -- : Article Load (0.9ms) SELECT "articles".* FROM "articles" WHERE "articles"."feed_id" = $1 [["feed_id", 18]]
2014-09-23T04:30:37.497891+00:00 app[web.1]: D, [2014-09-23T04:29:25.196031 #2] DEBUG -- : Article Load (0.9ms) SELECT "articles".* FROM "articles" WHERE "articles"."feed_id" = $1 [["feed_id", 19]]
2014-09-23T04:30:37.497892+00:00 app[web.1]: D, [2014-09-23T04:29:25.199035 #2] DEBUG -- : Article Load (2.5ms) SELECT "articles".* FROM "articles" WHERE "articles"."feed_id" = $1 [["feed_id", 20]]
2014-09-23T04:30:37.497894+00:00 app[web.1]: I, [2014-09-23T04:29:25.199882 #2] INFO -- : Completed 200 OK in 69ms (Views: 0.3ms | ActiveRecord: 28.5ms)
2014-09-23T04:30:37.497895+00:00 app[web.1]: I, [2014-09-23T04:30:09.983278 #2] INFO -- : Started GET "/" for 24.6.253.209 at 2014-09-23 04:30:09 +0000
2014-09-23T04:30:37.497897+00:00 app[web.1]: I, [2014-09-23T04:30:09.987649 #2] INFO -- : Processing by PagesController#index as HTML
2014-09-23T04:30:37.497898+00:00 app[web.1]: D, [2014-09-23T04:30:09.990690 #2] DEBUG -- : User Load (1.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 ORDER BY "users"."id" ASC LIMIT 1
2014-09-23T04:30:37.497900+00:00 app[web.1]: I, [2014-09-23T04:30:09.993971 #2] INFO -- : Rendered pages/index.html within layouts/application (0.5ms)
2014-09-23T04:30:37.497901+00:00 app[web.1]: I, [2014-09-23T04:30:09.994855 #2] INFO -- : Completed 200 OK in 7ms (Views: 3.5ms | ActiveRecord: 1.3ms)
2014-09-23T04:30:37.497902+00:00 app[web.1]: I, [2014-09-23T04:30:10.918573 #2] INFO -- : Started GET "/articles" for 24.6.253.209 at 2014-09-23 04:30:10 +0000
2014-09-23T04:30:37.497904+00:00 app[web.1]: I, [2014-09-23T04:30:10.922422 #2] INFO -- : Processing by ArticlesController#index as JSON
2014-09-23T04:30:37.497905+00:00 app[web.1]: D, [2014-09-23T04:30:10.925552 #2] DEBUG -- : User Load (1.7ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 ORDER BY "users"."id" ASC LIMIT 1
2014-09-23T04:30:37.497907+00:00 app[web.1]: D, [2014-09-23T04:30:10.929624 #2] DEBUG -- : Feed Load (1.5ms) SELECT "feeds".* FROM "feeds" INNER JOIN "subscriptions" ON "feeds"."id" = "subscriptions"."feed_id" WHERE "subscriptions"."user_id" = $1 [["user_id", 1]]
2014-09-23T04:30:37.497909+00:00 app[web.1]: D, [2014-09-23T04:30:10.936177 #2] DEBUG -- : Article Load (1.0ms) SELECT "articles".* FROM "articles" WHERE "articles"."feed_id" = $1 [["feed_id", 10]]
2014-09-23T04:30:37.497910+00:00 app[web.1]: D, [2014-09-23T04:30:10.937606 #2] DEBUG -- : Article Load (0.9ms) SELECT "articles".* FROM "articles" WHERE "articles"."feed_id" = $1 [["feed_id", 11]]
2014-09-23T04:30:37.497912+00:00 app[web.1]: D, [2014-09-23T04:30:10.939658 #2] DEBUG -- : Article Load (1.5ms) SELECT "articles".* FROM "articles" WHERE "articles"."feed_id" = $1 [["feed_id", 12]]
2014-09-23T04:30:37.497913+00:00 app[web.1]: D, [2014-09-23T04:30:10.941542 #2] DEBUG -- : Article Load (1.5ms) SELECT "articles".* FROM "articles" WHERE "articles"."feed_id" = $1 [["feed_id", 13]]
2014-09-23T04:30:37.497932+00:00 app[web.1]: D, [2014-09-23T04:30:10.943625 #2] DEBUG -- : Article Load (1.6ms) SELECT "articles".* FROM "articles" WHERE "articles"."feed_id" = $1 [["feed_id", 14]]
2014-09-23T04:30:37.497933+00:00 app[web.1]: D, [2014-09-23T04:30:10.944958 #2] DEBUG -- : Article Load (0.9ms) SELECT "articles".* FROM "articles" WHERE "articles"."feed_id" = $1 [["feed_id", 15]]
2014-09-23T04:30:37.497935+00:00 app[web.1]: D, [2014-09-23T04:30:10.946202 #2] DEBUG -- : Article Load (0.8ms) SELECT "articles".* FROM "articles" WHERE "articles"."feed_id" = $1 [["feed_id", 16]]
2014-09-23T04:30:37.497936+00:00 app[web.1]: D, [2014-09-23T04:30:10.947584 #2] DEBUG -- : Article Load (0.9ms) SELECT "articles".* FROM "articles" WHERE "articles"."feed_id" = $1 [["feed_id", 17]]
2014-09-23T04:30:37.497938+00:00 app[web.1]: D, [2014-09-23T04:30:10.949194 #2] DEBUG -- : Article Load (1.2ms) SELECT "articles".* FROM "articles" WHERE "articles"."feed_id" = $1 [["feed_id", 18]]
2014-09-23T04:30:37.497940+00:00 app[web.1]: D, [2014-09-23T04:30:10.950493 #2] DEBUG -- : Article Load (0.9ms) SELECT "articles".* FROM "articles" WHERE "articles"."feed_id" = $1 [["feed_id", 19]]
2014-09-23T04:30:37.497941+00:00 app[web.1]: D, [2014-09-23T04:30:10.951773 #2] DEBUG -- : Article Load (0.9ms) SELECT "articles".* FROM "articles" WHERE "articles"."feed_id" = $1 [["feed_id", 20]]
2014-09-23T04:30:37.497943+00:00 app[web.1]: I, [2014-09-23T04:30:10.952334 #2] INFO -- : Completed 200 OK in 30ms (Views: 0.2ms | ActiveRecord: 15.1ms)
2014-09-23T04:30:37.497944+00:00 app[web.1]: I, [2014-09-23T04:30:31.985603 #2] INFO -- : Started POST "/feeds/search" for 24.6.253.209 at 2014-09-23 04:30:31 +0000
2014-09-23T04:30:37.497946+00:00 app[web.1]: I, [2014-09-23T04:30:31.993881 #2] INFO -- : Processing by FeedsController#search as JSON
2014-09-23T04:30:37.497947+00:00 app[web.1]: I, [2014-09-23T04:30:31.993977 #2] INFO -- : Parameters: {"url"=>"q", "feed"=>{"url"=>"q"}}
2014-09-23T04:30:37.497952+00:00 app[web.1]: I, [2014-09-23T04:30:32.186407 #2] INFO -- : Completed 200 OK in 192ms (Views: 0.5ms | ActiveRecord: 0.0ms)
2014-09-23T04:30:37.497954+00:00 app[web.1]: I, [2014-09-23T04:30:37.487812 #2] INFO -- : Started GET "/feeds" for 24.6.253.209 at 2014-09-23 04:30:37 +0000
2014-09-23T04:30:37.497955+00:00 app[web.1]: I, [2014-09-23T04:30:37.497710 #2] INFO -- : Processing by FeedsController#index as JSON
2014-09-23T04:30:38.601702+00:00 app[web.1]: D, [2014-09-23T04:30:37.508654 #2] DEBUG -- : User Load (1.4ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 ORDER BY "users"."id" ASC LIMIT 1
2014-09-23T04:30:38.601707+00:00 app[web.1]: D, [2014-09-23T04:30:37.512314 #2] DEBUG -- : Feed Load (1.5ms) SELECT "feeds".* FROM "feeds" INNER JOIN "subscriptions" ON "feeds"."id" = "subscriptions"."feed_id" WHERE "subscriptions"."user_id" = $1 [["user_id", 1]]
2014-09-23T04:30:38.601709+00:00 app[web.1]: I, [2014-09-23T04:30:37.517631 #2] INFO -- : Completed 200 OK in 20ms (Views: 6.1ms | ActiveRecord: 2.9ms)
2014-09-23T04:30:38.601711+00:00 app[web.1]: I, [2014-09-23T04:30:37.779048 #2] INFO -- : Started POST "/feeds/create" for 24.6.253.209 at 2014-09-23 04:30:37 +0000
2014-09-23T04:30:38.601713+00:00 app[web.1]: I, [2014-09-23T04:30:37.802768 #2] INFO -- : Processing by FeedsController#create as JSON
2014-09-23T04:30:38.601715+00:00 app[web.1]: I, [2014-09-23T04:30:37.802879 #2] INFO -- : Parameters: {"url"=>"feed/http://www.questionablecontent.net/QCRSS.xml", "feed"=>{"url"=>"feed/http://www.questionablecontent.net/QCRSS.xml"}}
2014-09-23T04:30:38.601717+00:00 app[web.1]: D, [2014-09-23T04:30:37.977191 #2] DEBUG -- : Feed Load (8.1ms) SELECT "feeds".* FROM "feeds" WHERE "feeds"."feedly_feed_id" IS NULL LIMIT 1
2014-09-23T04:30:38.601719+00:00 app[web.1]: D, [2014-09-23T04:30:37.981727 #2] DEBUG -- : (2.8ms) BEGIN
2014-09-23T04:30:38.601721+00:00 app[web.1]: D, [2014-09-23T04:30:37.994355 #2] DEBUG -- : Feed Exists (9.1ms) SELECT 1 AS one FROM "feeds" WHERE "feeds"."feedly_feed_id" = 'feed/http://www.questionablecontent.net/QCRSS.xml' LIMIT 1
2014-09-23T04:30:38.601723+00:00 app[web.1]: D, [2014-09-23T04:30:38.006709 #2] DEBUG -- : SQL (1.7ms) INSERT INTO "feeds" ("created_at", "description", "feedly_feed_id", "name", "num_subscribers", "topics", "updated_at", "url") VALUES ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING "id" [["created_at", "2014-09-23 04:30:37.994655"], ["description", "Deathmøle Jacques' head takes up the bottom half of the panel, with his words taking up the top half. He is not concerned about the life of his friend."], ["feedly_feed_id", "feed/http://www.questionablecontent.net/QCRSS.xml"], ["name", "QC RSS"], ["num_subscribers", 50874], ["topics", "comics,webcomics,web comics,fun,humor"], ["updated_at", "2014-09-23 04:30:37.994655"], ["url", "http://www.questionablecontent.net"]]
2014-09-23T04:30:38.601741+00:00 app[web.1]: D, [2014-09-23T04:30:38.011917 #2] DEBUG -- : (4.7ms) COMMIT
2014-09-23T04:30:38.601743+00:00 app[web.1]: D, [2014-09-23T04:30:38.016273 #2] DEBUG -- : User Load (3.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 ORDER BY "users"."id" ASC LIMIT 1
2014-09-23T04:30:38.601744+00:00 app[web.1]: D, [2014-09-23T04:30:38.019696 #2] DEBUG -- : (1.9ms) BEGIN
2014-09-23T04:30:38.601746+00:00 app[web.1]: D, [2014-09-23T04:30:38.083515 #2] DEBUG -- : SQL (2.8ms) INSERT INTO "subscriptions" ("created_at", "feed_id", "updated_at", "user_id") VALUES ($1, $2, $3, $4) RETURNING "id" [["created_at", "2014-09-23 04:30:38.049168"], ["feed_id", 21], ["updated_at", "2014-09-23 04:30:38.049168"], ["user_id", 1]]
2014-09-23T04:30:38.601747+00:00 app[web.1]: D, [2014-09-23T04:30:38.093502 #2] DEBUG -- : (7.6ms) COMMIT
2014-09-23T04:30:38.601749+00:00 app[web.1]: D, [2014-09-23T04:30:38.396551 #2] DEBUG -- : Feed Load (9.5ms) SELECT "feeds".* FROM "feeds" WHERE "feeds"."feedly_feed_id" = 'feed/http://www.questionablecontent.net/QCRSS.xml' LIMIT 1
2014-09-23T04:30:38.601751+00:00 app[web.1]: #<Article id: nil, feed_id: nil, canonical_url: nil, site_url: nil, visual_url: nil, visual_height: nil, visual_width: nil, author: nil, title: nil, keywords: nil, summary: nil, feedly_id: nil, published: nil, fb_share_count: nil, fb_like_count: nil, fb_comment_count: nil, twitter_count: nil, reddit_score: nil, reddit_comment_count: nil, created_at: nil, updated_at: nil, calculated_rank: nil>
2014-09-23T04:30:38.773050+00:00 heroku[router]: at=info method=POST path="/feeds/create" host=hidden-lowlands-5596.herokuapp.com request_id=9c3683ee-dabc-4e34-bfb0-c309dc547596 fwd="24.6.253.209" dyno=web.1 connect=289ms service=1018ms status=500 bytes=330
I'm really stumped on this one, any help would be greatly appreciated. Thanks :)

Resources