parent
9b03bbd714
commit
eb029fb99b
@ -1,2 +1,13 @@
|
||||
module MoviesHelper
|
||||
def total_gross(movie)
|
||||
if movie.flop?
|
||||
"Flop!"
|
||||
else
|
||||
number_to_currency(movie.total_gross, precision: 0)
|
||||
end
|
||||
end
|
||||
|
||||
def year_of(movie)
|
||||
movie.released_on.year
|
||||
end
|
||||
end
|
||||
|
@ -1,2 +1,5 @@
|
||||
class Movie < ApplicationRecord
|
||||
def flop?
|
||||
total_gross.blank? || total_gross < 225_000_000
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in new issue