Rails button_to vs. HTML Button Tag

button_to like all others helpers for the views in Rails (e.g. link_to, form_for, image_tag…) simply converts your Rails command in HTML code. We could say that is a shortcut to write “pure HTML”. In your case, for button_to, you can see the reference (and what is printed) here: http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#method-i-button_to For example: I suggest you to … Read more

Uncaught ReferenceError: React is not defined

I was able to reproduce this error when I was using webpack to build my javascript with the following chunk in my webpack.config.json: This above configuration tells webpack to not resolve require(‘react’) by loading an npm module, but instead to expect a global variable (i.e. on the window object) called React. The solution is to … Read more

An unhandled lowlevel error occurred. The application logs may have details

This is because you haven’t set your secret key correctly. Double check your config/secrets.yml file: It should be something like this: production: secret_key_base: <%= ENV[“SECRET_KEY_BASE”] %> Then in your droplet, you can run bundle exec rake secret to get your secret key. There are options like dotenv which is a useful gem that loads the … Read more

“Error installing rails” because “extconf.rb failed” on Ubuntu 18.04

Here are the docs to install nokogiri https://nokogiri.org/tutorials/installing_nokogiri.html, there is a note for rvm: Note for RVM users: you may require libgmp, consider running sudo apt-get install libgmp-dev. Remove ruby with rvm https://rvm.io/rubies/removing Install Ruby Rails For a existing project

Difference between rake db:migrate db:reset and db:schema:load

db:migrate runs (single) migrations that have not run yet. db:create creates the database db:drop deletes the database db:schema:load creates tables and columns within the existing database following schema.rb. This will delete existing data. db:setup does db:create, db:schema:load, db:seed db:reset does db:drop, db:setup db:migrate:reset does db:drop, db:create, db:migrate Typically, you would use db:migrate after having made changes to the schema via new migration … Read more