Api::AsciicastsController

openid
Marcin Kulik 13 years ago
parent 268d4b1660
commit 59dbd5aea3

@ -0,0 +1,14 @@
class Api::AsciicastsController < ApplicationController
skip_before_filter :verify_authenticity_token
def create
ac = Asciicast.new(params[:asciicast])
if ac.save
render :text => asciicast_url(ac), :status => 201
else
render :text => ac.errors.full_messages, :status => 422
end
end
end

@ -2,6 +2,10 @@ AsciiIo::Application.routes.draw do
resources :asciicasts resources :asciicasts
match ':id' => 'asciicasts#show', :constraints => { :id => /\d+/ } match ':id' => 'asciicasts#show', :constraints => { :id => /\d+/ }
namespace :api do
resources :asciicasts
end
# The priority is based upon order of creation: # The priority is based upon order of creation:
# first created -> highest priority. # first created -> highest priority.

@ -0,0 +1,5 @@
require 'spec_helper'
describe Api::AsciicastsController do
end
Loading…
Cancel
Save