 $     = Spine.$
 Model = Spine.Model
 
-getURL = (object) ->
-  object and object.url?() or object.url
-  
 Ajax =
   enabled:  true
   pending:  false
   requests: []
+  getURL: (object) ->
+    object and object.url?() or object.url
 
   disable: (callback) ->
     @enabled = false

  ajax: -> new Singleton(this)

  url: ->
    base = Ajax.getUrl(@constructor)
    base += "/" unless base.charAt(base.length - 1) is "/"
    base += encodeURIComponent(@id)
    base

  constructor: (@record) ->
    super
    @model = @record.constructor
    @url   = Ajax.getURL(@record)
  
  find: (params) ->
    @send params
