Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 746d0004c6
Fetching contributors…

Cannot retrieve contributors at this time

13 lines (11 sloc) 0.564 kB
class LiveValidationsController < ApplicationController
session :off
# Poll with /live_validations/uniqueness?model_class=User&column=username&value=theusername. Returns
# either 'true' or 'false'. This should probably be converted to some adapter specific code.
def uniqueness
model_class = params[:model_class].constantize
column = params[params[:model_class].downcase].keys.first
value = params[params[:model_class].downcase][column]
render :text => (model_class.count(:conditions => {column => value}) == 0)
end
end
Jump to Line
Something went wrong with that request. Please try again.