lib/carte/server.rb in carte-server-1.0.7 vs lib/carte/server.rb in carte-server-1.0.8

- old
+ new

@@ -82,12 +82,12 @@ card = Card.where(title: params[:title]).first halt 404 if card.nil? { card: card.as_json(only: %w(title content version tags)).update( version: card.version, - lefts: card.lefts(4).as_json(only: %w(title content version tags)), - rights: card.rights(4).as_json(only: %w(title content version tags)) + lefts: card.lefts(4, context).as_json(only: %w(title content version tags)), + rights: card.rights(4, context).as_json(only: %w(title content version tags)) ) }.to_json end post '/cards.json' do @@ -121,10 +121,15 @@ #end get '/cards/:title/history.json' do card = Card.where(title: params[:title]).first halt 404 if card.nil? - {history: card.histories.as_json(only: %w(title content version tags))}.to_json + { + history: [ + card.as_json(only: %w(title content version tags)).update(version: card.version), + card.histories.desc(:version).as_json(only: %w(title content version tags)) + ].flatten + }.to_json end get '/tags.json' do {tags: Card.all_tags}.to_json end