Skip to content

Instantly share code, notes, and snippets.

def search
@posts = Post.find(:all, :conditions => ['title LIKE ?', "#{params[:query]}%"], :order => "title")
results = [:query => "#{params[:query]}"]
suggestions = []
@posts.each do |x|
suggestions << "#{x.title}"
end
results << {:suggestions => suggestions}
puts results
respond_to do |format|
def playlist
list = []
songs = Song.all
songs.each do |s|
list.push([trackinfo => "#{s.artist.name} | #{s.name}", mp3 => "#{s.mp3.url}"])
end
return list.to_json
end