can’t connect localhost:3000 ruby on rails in vagrant

The solution is running the code below to start your server: rails s -b 0.0.0.0 I found this solution from another post about same problem. The answerer said ‘You’ll want to make sure that the server is binded to 0.0.0.0 so that all interfaces can access it.” I hope this post helps people who encounter … Read more

Add nullable foreign key in Rails

Note that in Rails 5 and in Rails 6 you may need to mark the corresponding association as optional if it’s 1:n (belongs_to), as the default was changed: belongs_to :author, optional: true This is the corresponding Changeset. To use the old behavior across your application, you can also set: Rails.application.config.active_record.belongs_to_required_by_default = false in config/initializers/new_framework_defaults.rb The … Read more

Why doesn’t Rails autoload classes from app/services?

I encountered the same problem and it seems to be a caching issue with Spring, a process which handles preloading your app. It’s used for the web server as well as the console and Rake tasks. Stopping Spring with bin/spring stop will force Spring to load your app fresh. Now running rails console and inspecting … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)