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 ?

Damien Compère
  • 219
  • 1
  • 3
  • 16
  • what version of rails do you have? does it work locally? – Igor Kasyanchuk Mar 18 '19 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. – Damien Compère Mar 19 '19 at 08:33
  • I got the answer : you need to configure your gem file to have squlite3 in development and 'pg' in production as here : https://stackoverflow.com/questions/21297160/detected-sqlite3-gem-which-is-not-supported-on-heroku . 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). – Damien Compère Mar 19 '19 at 14:36
  • Please mark question as answered. – NemyaNation Mar 28 '19 at 18:53

1 Answers1

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.

NemyaNation
  • 983
  • 1
  • 12
  • 22