Sha256: 6d972687980dfd9c1b9821e9e466ae468f7af54b73a2adb5e50f01ead09dab5d

Contents?: true

Size: 604 Bytes

Versions: 5

Compression:

Stored size: 604 Bytes

Contents

class CacheableClientsController < ApplicationController
  self.responder = Restfulie::Server::ActionController::RestfulResponder
  respond_to :json

  def single
    response.last_modified = Time.utc(2010, 2) if params[:last_modified]
    respond_with song_at(2010)
  end

  def collection
    respond_with [song_at(2010), song_at(2009)]
  end

  def new_record
    model = song_at(2010)
    model.new_record = true
    respond_with(model)
  end

  def empty
    respond_with []
  end
  
  private
  def song_at(year)
    Song.new(:created_at => Time.utc(year), :updated_at => Time.utc(year))
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
restfulie-nosqlite-1.0.4 tests/app/controllers/cacheable_songs_controller.rb
restfulie-1.1.1 tests/app/controllers/cacheable_songs_controller.rb
restfulie-1.1.0 tests/app/controllers/cacheable_songs_controller.rb
restfulie-nosqlite-1.0.3 tests/app/controllers/cacheable_songs_controller.rb
restfulie-1.0.3 tests/app/controllers/cacheable_songs_controller.rb