Skip to content

Instantly share code, notes, and snippets.

@slowjud
Last active August 29, 2015 14:00
Show Gist options
  • Save slowjud/4836ce967413082c351e to your computer and use it in GitHub Desktop.
Save slowjud/4836ce967413082c351e to your computer and use it in GitHub Desktop.
API domain objects
module Api::V1
class foo
include ActiveModel::Serializers::JSON
def create(attrs)
end
def find(id)
end
def attributes=(attrs)
end
def attributes
end
end
end
module Api:V1
class fooController < ApplicationController
def show
render json: Api::V1::Foo.find params[:id]
end
def create
render json: Api::V1::Foo.create params[:foo]
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment