Created
March 11, 2011 19:06
-
-
Save kracekumar/866387 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def admission2 | |
@student = Student.find params[:id], :include => [:guardians] | |
@guardian = Guardian.new params[:guardian] | |
@g_u=GuardianUser.new() | |
@g_u[:guardian_id]=@guardian[:id] | |
@g_u[:email]=@guardian[:email] | |
@g_u[:ward_id]=@guardian[:ward_id] | |
randstr="" | |
chars=("0".."9").to_a + ("a".."z").to_a + ("A".."Z").to_a | |
8.times { randstr << chars[rand(chars.size -1)] } | |
@g_u[:salt]=randstr | |
@g_u[:hashed_password]=Digest::SHA1.hexdigest(@g_u[:salt]+@g_u[:email]) | |
if request.post? and @guardian.save and @g_u.save | |
redirect_to :controller => "student", :action => "admission2", :id => @student.id | |
end | |
end | |
error | |
/var/www/admin/app/controllers/student_controller.rb:93:in `size' | |
/var/www/admin/app/controllers/student_controller.rb:93:in `admission2' | |
/var/www/admin/app/controllers/student_controller.rb:93:in `times' | |
/var/www/admin/app/controllers/student_controller.rb:93:in `admission2' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
rand(chars.size - 1)