大家好!我是一个新手 ruby 程序员 希望大家多多指教!
我是怎么写 但是不行啊 View: <%=form_tag "/ajax/login", remote: true, method: 'post' do%> 用户名:<%=text_field_tag 'username' %> 密 码:<%=password_field_tag 'password'%> <%=submit_tag '登录'%> <%end%>
Controller: def login user=User.verification_return_user(params[:username], params[:password]) @result=false if user session[:user]=user @result=true end end
提交上去输出的是这个:
Started POST "/ajax/login" for 127.0.0.1 at 2012-05-10 09:06:38 +0800 Processing by AjaxController#login as JS Parameters: {"utf8"=>"✓", "authenticity_token"=>"q/SRVvcyjF5l1ZhSfAs09SLb7fb4YH5VUNWpz9pOqCo=", "username"=>"", "password"=>"[FILTERED]", "commit"=>"登录"} User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."username" = '' LIMIT 1 Rendered ajax/login.html.erb within layouts/application (0.0ms) Completed 200 OK in 91ms (Views: 29.0ms | ActiveRecord: 0.0ms)
但是页面什么反映也没有。。