Last active
August 29, 2015 14:00
-
-
Save slowjud/4836ce967413082c351e to your computer and use it in GitHub Desktop.
API domain objects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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