class Desktopapp::DesktopAppPublications < Sinatra::Base get "/desktop/journal_p" do erb :journal_p end get "/desktop/journal_p_list" do erb :'journal_pages/list' end get '/desktop/journal_p_add' do erb :'journal_pages/add' end get '/desktop_publications/getjournals' do @journals = Journal.all data = Array.new @journals.each do |journal| @papers = journal.papers.all data << {"title" => journal.title, "papers" => @papers} end data.to_json end end