Rails - Troubleshooting29 Mar 2018
- null array elements are removed in params
- Could not load ‘guard/rails’ or ‘~/.guard/templates/rails’ or find class Guard::Rails
- request is nil in ActionController::ParamsWrapper
rails credentials:editopens empty file every time
- basic authentication prompt is not shown
- No route matches [GET] “/admin/images/ui-icons_444444_256x240.png”
- git stderr: firstname.lastname@example.org: Permission denied (publickey).
null array elements are removed in params
data is sent in JSON format via POST request.
null array elements are present when reading request body directly:
# in controller request.body.read
but they are already removed in parsed params:
# in controller params.to_unsafe_h
probably this has something to do with
perform_deep_munge Rails feature - you
might try to disable it:
config.action_dispatch.perform_deep_munge = false
but I’ve chosen to send
null array elements as empty strings - they are not
removed by Rails and are properly converted to
Form schema of
Could not load ‘guard/rails’ or ‘~/.guard/templates/rails’ or find class Guard::Rails
$ guard init rails ERROR - Could not load 'guard/rails' or '~/.guard/templates/rails' or find class Guard::Rails
guard init rails - I have no
guard-rails gem in Gemfile. follow
instructions from https://github.com/guard/guard-rspec instead to create
$ guard init rspec
it’s possible to disable CSRF for API requests altogether either in
ApplicationController or specific controller with:
request is nil in ActionController::ParamsWrapper
error was caused by having
request action in controller which returned nil
(this action must have overriden corresponding Rails method) => don’t use
request name for any methods inside controllers.
rails credentials:edit opens empty file every time
whatever I type in this file is not saved to config/credentials.yml.enc.
use terminal-based editor instead of my default editor MacVim:
$ EDITOR=vim rails credentials:edit $ rails credentials:show
basic authentication prompt is not shown
the page keeps loading but no prompt is shown:
# log/production.log Started GET "/admin/users" for 126.96.36.199 at 2018-05-22 11:06:29 +0000 Processing by Admin::UsersController#index as HTML Filter chain halted as :basic_auth rendered or redirected Completed 401 Unauthorized in 0ms
I have another application with basic authentication on adjacent subdomain: maybe, saved credentials for another subdomain and are automatically applied for current subdomain.
so first I tried to remove entry for another subdomain from
application (macOS) but that didn’t help.
eventually it turned out the problem was caused by Dashlane Chrome extension - I managed to get basic authentication prompt once I temporarily disabled the latter.
No route matches [GET] “/admin/images/ui-icons_444444_256x240.png”
Started GET "/admin/images/ui-icons_444444_256x240.png" for ::1 at 2018-05-22 23:33:20 +0300 ActionController::RoutingError (No route matches [GET] "/admin/images/ui-icons_444444_256x240.png"):
this error occurs when any Rails or Phoenix application page is opened - either in development or production environment.
most likely GET request to fetch
ui-icons_444445_256x240.png is made when ANY
page is opened - these requests just don’t draw attention unless I see them in
server logs of my applications.
it has turned out that the culprit is
Clouder Chrome extension => disable it
git stderr: email@example.com: Permission denied (publickey).
$ cap production deploy ... 00:00 git:check 01 git ls-remote firstname.lastname@example.org:complead/iceperk.git HEAD 01 email@example.com: Permission denied (publickey). 01 fatal: Could not read from remote repository. 01 01 Please make sure you have the correct access rights 01 and the repository exists.
$ ssh-add ~/.ssh/id_rsa $ cap production deploy