def search_results
@keyword = request.raw_post
@tutors = Tutors.find(:all,:conditions => ["first_name LIKE ?", '%' + "raul" + '%'])
end
I am trying to get some information out of request.raw_post
, but it is giving me this long string: "authenticity_token=HxxkPMpSr0kHZOVZIYbpMti217BTeUa5G2vX8zbs8ig%3D&keyword=alex&authenticity_token=HxxkPMpSr0kHZOVZIYbpMti217BTeUa5G2vX8zbs8ig%3D."
B开发者_Go百科asically, I just to get "alex," where it says "keyword=alex." How can I do it?
If you want that value, I would suggest using params[:keyword]
.
Or alternatively, request.raw_post.split(/&/).grep(/keyword=/).first.split(/=/).last
精彩评论