Ruby-on-rails – rails, Heroku does not load my lib

I am working in a new rails application and I created a small utility class in RAILS_ROOT/lib. I use this class in a controller with require. This class is loaded correctly locally, but when I deploy the application on heroku, it crashes:

LoadError (no such file to load — MyUtilityClass)

Any ideas?

Update:

I found this problem. In my controller, I did a’require “MyUtilityClas”‘, which works fine locally. On heroku I Need to do a’require’/lib/my_utility_class.rb”‘. Hmm… I really don’t understand why…

< div class="answer"> Assuming you have named the file correctly, you need’my_file_to_require’.

Require requires the file name, not the module/class name, so:

require'MyUtilityClass' # wrong

It is wrong but

require'my_utility_class' # correct

< p> is correct, again assuming you stick to the normal ruby/rails file naming convention.

I am working in a new rails application, I am in RAILS_ROOT/lib A small utility class is created in. I use this class in a controller with require. This class is loaded correctly locally, but when I deploy the application on heroku, it crashes:

LoadError (no such file to load — MyUtilityClass)

Any ideas?

Update:

I found this problem. In my controller, I made a’require “MyUtilityClas”‘, which works fine locally. On heroku I need to do a’require’/ lib/my_utility_class.rb “‘. Hmm… I really don’t understand why…

Assuming you have named the file correctly, you need’my_file_to_require’ .

Require requires the file name, not the module/class name, so:

require'MyUtilityClass' # wrong

< p>It’s wrong but

require'my_utility_class' # correct

It is correct, again assuming you stick to the normal ruby/rails file naming convention.

< p>

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 3302 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.