What this code lines mean? Especially $:. before the unshift?
$:.unshift File.join(File.dirname(FILE),’…’,‘lib’)
Regards,
Mohsin
What this code lines mean? Especially $:. before the unshift?
$:.unshift File.join(File.dirname(FILE),’…’,‘lib’)
Regards,
Mohsin
MohsinHijazee wrote:
What this code lines mean? Especially $:. before the unshift?
$:.unshift File.join(File.dirname(FILE),’…’,‘lib’)
Regards,
Mohsin
ruby comes with a set of predefined variables
$: = default search path (array of paths)
FILE = current sourcefile
if i get it right (not 100% sure) this adds the lib path to this array
of search paths by going over the current file. which is not exactly the
best way, i would simply start with RAILS_ROOT (at least for a rails
project)
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs