views:

46

answers:

3

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

+1  A: 

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.

Keltia
Yeah exactly i want to patch a gem containing some logic according to the parameters I get from the user 's request. I try what you proposed and mark the answer later on if it successful
PanosJee
A: 

It seems that CGI.new creates a new object and does not contain the params of current request

PanosJee
A: 

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

gudleik