you are here: codestackercodes [RSS]check avaliability

check avaliability

# controller

def check_availability
  render :update do |page|
    if User.find(:first, :conditions => { :login => params[:user][:login] })
      page[:login_instant_feedback].replace_html 'Not available'
    end
  end
end

# view

link_to_remote 'check availability', { :url => { :action => 'check_availability' }, :before => $('login_instant_feedback').update('checking...'); new Effect.Appear('login_instant_feedback');" }

Comments