Reputation: 789
I need to create a "global" variable. I create it in the file boot.rb.
RAILS_CAR_IMAGES = Rails.root.to_s + "/app/assets/images/" unless defined?(RAILS_CAR_IMAGES)
But it pops up an error. "uninitialized constant Rails (NameError)"
Where should I create a global variable (contains path relative to the root folder) to save the uploaded images?
Upvotes: 0
Views: 340
Reputation: 6941
In boot.rb
Rails has not been initialized ... Create a file in config/initializers
with a name like car_images.rb and put the code there
Upvotes: 1