1

I'm trying to move my Ruby Application to Heroku for the first time, first I updated my Ruby version to 2.4.1, I also moved my sqlite3 in development to have :

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
  gem 'sqlite3','~> 1.3.13'
end

And now that I can push my app, the app doesnt start and I have the following error "method_missing': undefined method `has_one_attached' for # (NoMethodError)" while running heroku run rails console. Could anybody help me to fix that ?

4
  • what version of rails do you have? does it work locally? Commented Mar 18, 2019 at 19:01
  • Thanks for yout answer ! With this configuration no, but when I add gem 'sqlite3' in my gem file, yes. The thing is that gem 'sqlite3' is not supported on heroku as i understood. Do you have any idea how to do ? Edit : to answer your question, I updated my Ruby to the '2.4.1' version. Commented Mar 19, 2019 at 8:33
  • I got the answer : you need to configure your gem file to have squlite3 in development and 'pg' in production as here : stackoverflow.com/questions/21297160/… . Once it's done bundle install and you have to re-create a db on heroku (and maybe modify the access to the db in production). Commented Mar 19, 2019 at 14:36
  • Please mark question as answered. Commented Mar 28, 2019 at 18:53

1 Answer 1

1

You are getting this error because your database is not configured in production on Heroku. The reason why the database is not configured is because Heroku does not support sqlite3.

You need to change your database to use postgresql for production and then push again to your heroku remote.

Instructions on how to do so can be found here.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.