mokus80 / learners_directory

4 stars 4 forks source link

App not running on Heroku #20

Closed mokus80 closed 10 years ago

mokus80 commented 10 years ago

I wanna make it work again but just started investigating. Any input is welcome.

mokus80 commented 10 years ago

Here is a gist with the logs: https://gist.github.com/mokus80/9137062

PragTob commented 10 years ago

Seems like the average_rating function in resource.rb has to deal with nil values.

E.g. here

self.ratings.each do |rating|
  @value = @value + rating.value
end

rating.value seems to be nil some times and that is already in the database.

So somehow a resource has ratings which have the value nil.

Solution would probably be to cleanse those from the database and write a validation that the rating value should be numerical.

Another solution would be to just check for nil values and then do nothing, for the long term it's not the best option though I believe.

mokus80 commented 10 years ago

Thanks Tobi, I fixed it by resetting the database. Validation has yet to be written.