You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This smells like a file isn't being loaded, so looking at twurl.rb, the culprit is this:
library_files = Dir[File.join(File.dirname(__FILE__), "/twurl/**/*.rb")]
library_files.each do |file|
require file
end
The reason this is a problem is the Dir[] construction doesn't guarantee any sort of order as it relies on the OS for ordering. We can see this by changing it to:
library_files = Dir[File.join(File.dirname(__FILE__), "/twurl/**/*.rb")]
puts "The first file loaded is: " + library_files.first
exit
Which outputs (on my system)
The first file loaded is: /home/rory/Documents/twurl/lib/twurl/request_controller.rb
Since request_controller subclasses AbstractCommandController, it fails because that file hasn't been loaded yet. There's two ways out of this: either specifying the requires by hand in order or setting up autoloads. (Rails dances around the issue by messing with autoload and using ActiveSupport for class symbol -> file name mapping)
I fixed this in my fork using autoloads and sent a pull request.
The text was updated successfully, but these errors were encountered:
On some systems, running twurl can can cause the error:
This smells like a file isn't being loaded, so looking at twurl.rb, the culprit is this:
The reason this is a problem is the Dir[] construction doesn't guarantee any sort of order as it relies on the OS for ordering. We can see this by changing it to:
Which outputs (on my system)
The first file loaded is: /home/rory/Documents/twurl/lib/twurl/request_controller.rb
Since request_controller subclasses AbstractCommandController, it fails because that file hasn't been loaded yet. There's two ways out of this: either specifying the requires by hand in order or setting up autoloads. (Rails dances around the issue by messing with autoload and using ActiveSupport for class symbol -> file name mapping)
I fixed this in my fork using autoloads and sent a pull request.
The text was updated successfully, but these errors were encountered: