Следующий скрипт хорошо работает в локальной среде, но после нажатия на героку выдает ошибку. Я размещаю свой RegistrationController, а также журналы с Heroku ниже ....................................... .................................................. .................................................. .........................................
RegistrationController:
class RegistrationsController < Devise::RegistrationsController
def create
build_resource(sign_up_params)
resource.class.transaction do
resource.save
yield resource if block_given?
if resource.persisted?
@payment = Payment.new({ email: params["user"]["email"],
token: params[:payment]["token"], user_id: resource.id })
flash[:error] = "Please check registration errors" unless @payment.valid?
begin
@payment.process_payment
@payment.save
rescue Exception => e
flash[:error] = e.message
resource.destroy
puts 'Payment failed'
render :new and return
end
if resource.active_for_authentication?
set_flash_message :notice, :signed_up if is_flashing_format?
sign_up(resource_name, resource)
respond_with resource, location: after_sign_up_path_for(resource)
else
set_flash_message :notice, :"signed_up_but_#{resource.inactive_message}" if
is_flashing_format?
expire_data_after_sign_in!
respond_with resource, location: after_inactive_sign_up_path_for(resource)
end
else
clean_up_passwords resource
set_minimum_password_length
respond_with resource
end
end
end
protected
def configure_permitted_parameters
devise_parameter_sanitizer.for(:sign_up).push(:payment)
end
end
журнал Heroku:
2020-05-05T16:13:04.965568+00:00 app[web.1]: [9be9b175-88b2-4738-bfd5-17dc7ee8f138]
Processing by RegistrationsController#create as HTML
2020-05-05T16:13:04.965660+00:00 app[web.1]: [9be9b175-88b2-4738-bfd5-17dc7ee8f138]
arameters{"authenticity_token"=>"a4zyaMdMWSHf8U0Wrc3eg0xhyusg1AeNQ31bcvwF6YKOcQNbnkK6dYAM4W
2hDqPm63vDPifvwFdagMpQb5OwyA==", "user"=>{"email"=>"test@example.com", "password"=>"
[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "payment"=>
{"token"=>"tok_1GfTOGI4LAM13FTZ10gJRfJL"}}
2020-05-05T16:13:05.150445+00:00 app[web.1]: [9be9b175-88b2-4738-bfd5-17dc7ee8f138]
(0.7ms) BEGIN
2020-05-05T16:13:05.151787+00:00 app[web.1]: [9be9b175-88b2-4738-bfd5-17dc7ee8f138] User
Exists? (1.1ms) SELECT 1 AS one FROM "users" WHERE "users"."email" = $1 LIMIT $2
[["email", "test@example.com"], ["LIMIT", 1]]
2020-05-05T16:13:05.154809+00:00 app[web.1]: [9be9b175-88b2-4738-bfd5-17dc7ee8f138] User
Create (0.9ms) INSERT INTO "users" ("email", "encrypted_password", "confirmation_token",
"confirmation_sent_at", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6)
RETURNING "id" [["email", "test@example.com"], ["encrypted_password",
"$2a$11$PCdOtdDn2VGg/4ozh4ql.OzzvcdfAIDmbuDsZyAzSp/BrpRTqQ7zy"], ["confirmation_token",
"Ek37GWnoPP5zXcGxe4y-"], ["confirmation_sent_at", "2020-05-05 16:13:05.152423"],
["created_at", "2020-05-05 16:13:05.152234"], ["updated_at", "2020-05-05 16:13:05.152234"]]
2020-05-05T16:13:05.157652+00:00 app[web.1]: [9be9b175-88b2-4738-bfd5-17dc7ee8f138]
(0.6ms) ROLLBACK
2020-05-05T16:13:05.158200+00:00 app[web.1]: [9be9b175-88b2-4738-bfd5-17dc7ee8f138]
Completed 500 Internal Server Error in 192ms (ActiveRecord: 13.5ms | Allocations: 3361)
2020-05-05T16:13:05.159760+00:00 app[web.1]: [9be9b175-88b2-4738-bfd5-17dc7ee8f138]
2020-05-05T16:13:05.159763+00:00 app[web.1]: [9be9b175-88b2-4738-bfd5-17dc7ee8f138]
ActiveRecord::StatementInvalid (PG::UndefinedTable: ERROR: relation "payments" does not
exist
2020-05-05T16:13:05.159763+00:00 app[web.1]: LINE 8: WHERE a.attrelid =
'"payments"'::regclass
2020-05-05T16:13:05.159764+00:00 app[web.1]: ^
2020-05-05T16:13:05.159764+00:00 app[web.1]: ):
2020-05-05T16:13:05.159764+00:00 app[web.1]: [9be9b175-88b2-4738-bfd5-17dc7ee8f138]
2020-05-05T16:13:05.159765+00:00 app[web.1]: [9be9b175-88b2-4738-bfd5-17dc7ee8f138]
app/controllers/registrations_controller.rb:15:in `block in create'
2020-05-05T16:13:05.159765+00:00 app[web.1]: [9be9b175-88b2-4738-bfd5-17dc7ee8f138]
app/controllers/registrations_controller.rb:7:in `create'
2020-05-05T16:13:05.162907+00:00 heroku[router]: at=info method=POST path="/users"
host=kphoto-app.herokuapp.com request_id=9be9b175-88b2-4738-bfd5-17dc7ee8f138
fwd="62.202.191.223" dyno=web.1 connect=0ms service=201ms status=500 bytes=1827
protocol=https
2020-05-05T16:13:05.404181+00:00 heroku[router]: at=info method=GET path="/favicon.ico"
host=kphoto-app.herokuapp.com request_id=ce0d65db-072d-4a9f-a8b4-55a0432bfddb
fwd="62.202.191.223" dyno=web.1 connect=0ms service=4ms status=304 bytes=48 protocol=https
kash@TheKash:~/rails/kphoto-app$