From 33788fb55ebbb8ed2f1f7a47d02d8463311eb50f Mon Sep 17 00:00:00 2001 From: Nicolae Claudius Date: Wed, 12 Oct 2011 11:35:34 -0700 Subject: [PATCH] records simple API --- app/controllers/as_controller.rb | 11 ----------- app/controllers/records_controller.rb | 11 +++++++++++ config/routes.rb | 6 +++--- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/app/controllers/as_controller.rb b/app/controllers/as_controller.rb index 18a59a8..446cdbf 100644 --- a/app/controllers/as_controller.rb +++ b/app/controllers/as_controller.rb @@ -12,17 +12,6 @@ class AsController < ApplicationController conf.actions.exclude :show end before_filter :ensure_nested_under_domain, :except => 'modify' - skip_before_filter :authenticate_user!, :only => 'modify' - protect_from_forgery :except => 'modify' - skip_authorize_resource :only => :modify - - # TODO: externalize - def modify - @a = A.where(:authentication_token => params[:authentication_token]).first! - @a.content = params[:ip] || client_remote_ip - @a.save! - respond_with @a - end protected diff --git a/app/controllers/records_controller.rb b/app/controllers/records_controller.rb index 58c8cd0..ccfe304 100644 --- a/app/controllers/records_controller.rb +++ b/app/controllers/records_controller.rb @@ -25,4 +25,15 @@ class RecordsController < ApplicationController conf.actions.exclude :show end before_filter :ensure_nested_under_domain + skip_before_filter :authenticate_user!, :only => 'modify' + protect_from_forgery :except => 'modify' + skip_authorize_resource :only => :modify + + # TODO: externalize + def modify + @record = Record.where(:authentication_token => params[:authentication_token]).first! + @record.content = params[:ip] || client_remote_ip + @record.save! + respond_with @arecord + end end diff --git a/config/routes.rb b/config/routes.rb index 4a5aac5..260e3d2 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -8,6 +8,9 @@ Entrydns::Application.routes.draw do resources :records do as_routes + collection do + put 'modify/:authentication_token', :action => 'modify' + end end resources :soas do @@ -24,9 +27,6 @@ Entrydns::Application.routes.draw do resources :as do as_routes - collection do - put 'modify/:authentication_token', :action => 'modify' - end end resources :cnames do