Skip to content

Instantly share code, notes, and snippets.

@andyh
Created September 17, 2013 23:02
Show Gist options
  • Save andyh/6601891 to your computer and use it in GitHub Desktop.
Save andyh/6601891 to your computer and use it in GitHub Desktop.
class Api::TradesController < ApplicationController
respond_to :json
def index
render json: DataTable.new(Trade, params)
end
def create
trade = Trade.new(safe_params)
trade.save
respond_with trade
end
def update
# respond_with Trade.update(params[:id], safe_params)
end
private
def safe_params
params.permit(:name)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment