简体   繁体   中英

Get params inside a Ruby gem

It there a way to read the params inside a class of a gem I tried require "cgi" and require "action_pack" but no chance... Any clues ?

Thanx

Be more precise. The params of what? A submitted form?

If yes, you could do that:

require "cgi"

...

cgi = CGI.new
h = cgi.params

login = h['login'][0]
password = h['password'][0]

and so on.

Maybe you can use Rack middleware for this. See also http://railscasts.com/episodes/151-rack-middleware for a tutorial.

似乎CGI.new创建了一个新对象,并且不包含当前请求的参数

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM