For my Predictions model I created a method in predictions_helper.rb like this:
module PredictionsHelper
def time_in_date(time, date)
time.between(date..date+1.day)
end
end
However, when I call it like this:
time_in_date(le.time, date)
I get the following error:
NoMethodError:
undefined method `time_in_date' for PredictionsHelper:Module
It seems like the easiest thing to do would be to include your module in your Predictions class
class Prediction < ActiveRecord::Base
include PredictionsHelper
end
That will give you access to time_in_date
The predictions_helper is within scope of the Predictions model, however, since you've put it inside of a module, you'll need to include that module.
So:
include PredictionsHelper
# code...
or
PredictionsHelper::time_in_date(le.time, date)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With