Skip to content

Commit

Permalink
Artist stores data response in instance var
Browse files Browse the repository at this point in the history
[#3] cache lyrics
  • Loading branch information
alxndr committed Nov 18, 2013
1 parent c07095f commit b332b05
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/models/artist.rb
Expand Up @@ -51,8 +51,9 @@ def lyrem(config)
def get_data
raise 'no name' unless name && name.present?

@data = fetch_data_for_artist(name) or raise 'artist data not found'
self.data = @data.to_json
self.slug = name.to_slug
self.data = fetch_data_for_artist(name).to_json or raise 'artist data not found'
end

def fetch_new_song_lyrics
Expand Down Expand Up @@ -107,7 +108,7 @@ def song_names
end

def albums
@albums ||= JSON.parse(data)['albums']
@albums ||= @data['albums']
end

def album_names
Expand Down

0 comments on commit b332b05

Please sign in to comment.