I've added autocompleted searchbar for users to my app ("gem searchkick" and "elasticsearch" were used) then it is great working on localhost. I have also added "SearchBox Elasticsearch -- Starter" to my Heroku app.
After I can push my app to heroku without fail but I've an error with "heroku run db:seed". (The first user can be installed but the second user is not)
How can I fix the problem?
Error
Running rake db:seed on bloggerpoint... up, run.7859
ActiveRecord::SchemaMigration Load (1.9ms) SELECT "schema_migrations".* FROM "schema_migrations"
(12.7ms) BEGIN
User Exists (1.6ms) SELECT 1 AS one FROM "users" WHERE LOWER("users"."email") = LOWER('example@railstutorial.org') LIMIT 1
SQL (1.1ms) INSERT INTO "users" ("name", "email", "password_digest", "admin", "activated", "activated_at", "created_at", "updated_at", "activation_digest") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9) RETURNING "id" [["name", "Example User"], ["email", "example@railstutorial.org"], ["password_digest", "$2a$10$tU5lWI6OSivx.9gONACjI.EHDrPgdhyQ9w/5rp6MxitVRpaRilbZu"], ["admin", "t"], ["activated", "t"], ["activated_at", "2015-12-08 20:06:39.898039"], ["created_at", "2015-12-08 20:06:40.199321"], ["updated_at", "2015-12-08 20:06:40.199321"], ["activation_digest", "$2a$10$kI/gNShPNgjz387uCxKBW.XT5OpYOJvL0ayb0G9EXRt6TqxgXjzTm"]]
(2.0ms) COMMIT
User Store (5.9ms) {"id":1,"exception":["Faraday::ConnectionFailed","Connection refused - connect(2)"]}
rake aborted!
production.rb
Elasticsearch::Model.client = Elasticsearch::Client.new host: ENV['search_box_url']
I've made addition to my User model and Gemfile before heroku deploy. My searchbar is working without them on localhost.
user.rb
include Elasticsearch::Model
include Elasticsearch::Model::Callbacks
Gemfile
group :production do
gem 'pg', '0.17.1'
gem 'rails_12factor', '0.0.2'
gem 'puma', '2.11.1'
gem 'elasticsearch-model'
gem 'elasticsearch-rails'
end
Aucun commentaire:
Enregistrer un commentaire