diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2015-10-15 10:11:56 +0200 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2015-10-28 21:32:17 +0100 |
commit | 57af2ee2e51b614ac6e2fa81b1075a55d3c0c252 (patch) | |
tree | 81731790772b47e444b8a1abb70abdec543da2dd /lib/song.rb | |
parent | c69ab8c2bc8dfa59070249dd434219d83a792dbc (diff) | |
download | norsk-urskog-registrations-57af2ee2e51b614ac6e2fa81b1075a55d3c0c252.tar.gz norsk-urskog-registrations-57af2ee2e51b614ac6e2fa81b1075a55d3c0c252.tar.bz2 norsk-urskog-registrations-57af2ee2e51b614ac6e2fa81b1075a55d3c0c252.zip |
Retain member and song info on errors in form.
Diffstat (limited to 'lib/song.rb')
-rw-r--r-- | lib/song.rb | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/song.rb b/lib/song.rb index 93172f2..482834e 100644 --- a/lib/song.rb +++ b/lib/song.rb @@ -1,13 +1,13 @@ class Song attr_reader :title, :time, :isrc, :composers, :performers, :notes - def initialize(params) - @title = params['title'] - @time = params['time'] - @isrc = params['isrc'] - @composers = params['composers'].split("\n") - @performers = params['performers'].split("\n") - @notes = params['notes'] + def initialize(params = nil) + @title = params ? params['title'] : '' + @time = params ? params['time'] : '' + @isrc = params ? params['isrc'] : '' + @composers = params ? params['composers'].split("\n") : [] + @performers = params ? params['performers'].split("\n") : [] + @notes = params ? params['notes'] : '' end def to_s |