On the other hand, if you do want to store the data in a database, create a new model called Song:
Code:
class Song < ActiveRecord::Base
end
Create a table called songs with the required fields. For example via migration
Code:
class CreateSongs < ActiveRecord::Migration
def self.up
create_table :songs do |t|
t.column :status, :string
t.column :absence, :string
t.column :lone_working_note, :string
t.timestamps
end
end
def self.down
drop_table :songs
end
end
And then change the code to this:
Code:
song = Song.new
song.source = item.elements['location'].text
song.song = item.elements['title'].text
song.artist = item.elements['creator'].text
song.save
@songs << song
Bookmarks