Skip to content

Instantly share code, notes, and snippets.

View rpdecks's full-sized avatar

Robert Phillips rpdecks

View GitHub Profile
def files
# I think I will need to create an array of file names here of the files whose data I want to import
@files = []
Dir.entries(path).select do |file|
if !File.directory?(file) && file.end_with?(".mp3")
# why does if need to check file.directory?
@files << file
end
end
end
@rpdecks
rpdecks / gist:263b3c56b6be531c18d8e92ed091c79b
Created April 6, 2020 01:33
artist_name= for Collaborating Objects Lab
def artist_name=(name)
self.artist = Artist.find_or_create_by_name(name)
artist.add_song(self) #why not self.add_song(self)??
end