Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # In Rails Controller
- def playlist
- @playlist = session[:playlist] = Playlist.new(current_user)
- render :layout => false
- end
- # In RAILS view
- xml.instruct! :xml, :version=>"1.0"
- xml.playlist do
- if @playlist.currently_playing?
- xml.currently_playing do
- xml.song_in_list @playlist.current_song_in_playlist?
- end
- end
- xml.songs do
- @playlist.songs.each do |song|
- xml.song do
- xml.id song.id
- xml.title song.title
- xml.artist song.artist
- xml.path song.public_path
- end
- end
- end
- end
- # Would generate
- <instruct...(whatever the XML stuff is for it>
- <playlist>
- <currently_playing>
- <song_in_list>12</song_in_list>
- </currently_playing>
- <songs>
- <song>
- <id>32</id>
- <title>Some cool song</title>
- <artist>Foo Fighters</artist>
- <path>/path/to/cool_song.mp3</path>
- </song>
- </songs>
- </playlist>
Add Comment
Please, Sign In to add comment