DEPRECATION WARNING: Dangerous query method: Random Record in ActiveRecord >= 5.2

If you want to continue using order by random() then just declare it safe by wrapping it in Arel.sql like the deprecation warning suggests: Model.order(Arel.sql(‘random()’)).first # PostgreSQL Model.order(Arel.sql(‘rand()’)).first # MySQL There are lots of ways of selecting a random row and they all have advantages and disadvantages but there are times when you absolutely must … Read more

Disable Active Storage in Rails 5.2

Remove next line from config/application.rb require “active_storage/engine” Remove next line from environments config/environments/*.rb config.active_storage.service = :local Remove next line from app/assets/javascripts/application.js //= require activestorage ActiveStorage rails routes will vanish In case there is statement require ‘rails/all’ in application.rb then you can use solution provided below where you need to require dependency by dependency and to … Read more

Rails: How to fix “Missing secret_key_base for ‘production’ environment”

Keep default the secrets.yml file # config/secrets.yml production: secret_key_base: <%= ENV[“SECRET_KEY_BASE”] %> aws_secret: abcde some_password: abcdex development: secret_key_base: static_secret_key aws_secret: abcde test: secret_key_base: static_test_secret_key #not_indented: key for all env in once secret_key_base: global_key_for_all_env RAILS_ENV=production SECRET_KEY_BASE=production_test_key rails c If using Rails 5.2.0, add to production env below, check this LINK config.require_master_key = true #config/environments/production.rb

Rails: ActiveSupport::MessageEncryptor::InvalidMessage

Here are the docs for environmental security on rails https://guides.rubyonrails.org/security.html#environmental-security In your case, you should have these files config/master.key config/credentials.yml.enc Delete those files and then you can generate them with this: rails credentials:edit –wait While the credentials are open, note the master.key string, and then close the editor. If you have not set the editor, … Read more

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