Usage of ~ (tilde) changed in Ruby or Rails?

14 views
Skip to first unread message

Ralph Shnelvar

unread,
Aug 2, 2018, 10:43:46 AM8/2/18
to rubyonra...@googlegroups.com
I am migrating some code from Rails 4 to Rails 5.


My current environment is:
Rails 5.2.0
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]


In my previous Rails 4 environment during initialization when environment.rb is being loaded I could require a file and in that file I had
 require '~/app/models/ralph_lib/ralph_sql'
and the file would load.

Now, when I invoke webrick, I get the error
 /home/mydomain/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require': cannot load such file -- ~/app/models/ralph_lib/ralph_sql (LoadError)

If, instead, I use
 require '/home/mydomain/app/models/ralph_lib/ralph_sql'
or
 require_relative '../app/models/ralph_lib/ralph_sql'
then ralph.sql loads successfuly

Am I overlooking some initialization in order to get tilde to work?

Ralph Shnelvar
Reply all
Reply to author
Forward
0 new messages