Skip to content

Commit

Permalink
Move tmdb_image method to ApplicationRecord
Browse files Browse the repository at this point in the history
  • Loading branch information
spohlenz committed Feb 18, 2019
1 parent c1f1d28 commit 7013289
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
5 changes: 5 additions & 0 deletions app/models/application_record.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true

protected
def tmdb_image(path, version="original")
"https://image.tmdb.org/t/p/#{version}#{path}"
end
end
4 changes: 0 additions & 4 deletions app/models/concerns/media.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,4 @@ def backdrop?
def backdrop_url(version="original")
tmdb_image(backdrop_path, version)
end

def tmdb_image(path, version="original")
"https://image.tmdb.org/t/p/#{version}#{path}"
end
end
4 changes: 0 additions & 4 deletions app/models/tv_show/season.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,4 @@ def poster?
def poster_url(version="original")
tmdb_image(poster_path, version)
end

def tmdb_image(path, version="original")
"https://image.tmdb.org/t/p/#{version}#{path}"
end
end

0 comments on commit 7013289

Please sign in to comment.