This post is all about how to change redirect url after devise update password
(or any?). By default, devise after change password successfully, it will
redirect to the root url. There are step you have to do to change the redirect
path.
Make devise controllers Or generate using command rails g
devise:controllers user
After generating, because I want to change the redirect url after changing
password. The only file I concern is passwords_controller.rb, the method you
have to override is after_resetting_password_path_for, within this method, you
have to declare your favorite redirect url.
In Phoenix web framework, there is a share directory /priv. By default, it
will only public css,js,images,fonts directory. However, If you want to share
a new directory to save upload image for example, you have to end_point file at
/lib/app_name/end_point.ex . Look at plug Plug.Static, the only: macro
declares which directory, files could be public. Simply, you have to append your
directory name at only:line.
This is my configuration to add a directory named avatar public. This directory
is under /priv/static.
I have work with spreadsheet gem on ruby, Sometime I do realize that in the
LibreOffice, the content is something like '24%, the character single quote
refers to a string. However, I want a number instead. A possible way to convert
them without programming is Find and Replace. However it does not easy as I
say because the character ' is a special character in LibreOffice, you have to
use regular expression to work with this.
There is a solution to convert string to number in such case is using replace
function name Find and Replace C-h in LibreOffice. In the Search for text,
type ^.; in the Replace with, type $. In the other options, please tick on
Regular expressions. Finally, you can choose replace or replace all.
Given that, you have to work with many decimal number for example: 0.335, 0.345,
0.2, 96.6666. And then you want to round those number 2 digits after decimal.
The most general way is to used toFix(). However, the behavior of toFix() is
not good. Let test with value 0.335 and 0.345.
The better solution is that, we try to use the first two digit after decimal, the only issue is that, these two digit up/down are depend on the third digit, perhaps the fifth one. Number 44 is to solve this issue. Any number x.a-b-c-d which has c-d >= 56, the b will be round up by one.
A good solution come up with a compact function which can help you use in any time.
Rails does support built-in CRUD with RESTful. It provides default url for
developers. However, there could be a time that developer want to add more
method/action to work with exist routes. Hence, this is solution.
This is a default setting for resources of pictures
This is modification with new upload method which use GET protocol.
My browsers always automatically redirect to advertise website. That’s a pain in
my ass. In particular, While I am reading software API, it change my current
pages to another ad pages. Seemingly, someone did change my default dns to
advertise dns server.
1. Change the DNS
Set the current dns to google dns: 8.8.8.8, 8.8.4.4
2. Reset the Network Manager
After finished this step, firefox should work well