简体   繁体   中英

rails: is “pollresponse” a magic keyword that is not allowed in query string?

Spent an hour debugging an "impossible" situation, where a query string pollresponse=true was simply not being recognized.

Basically, params[:pollresponse] seems to always be nil, even when the params hash clearly shows { 'pollresponse' => 'true' }

On a hunch, replaced it with another name and it worked as expected.

So I assume there is something "magic" though googling "rails pollresponse" didn't give me anything obvious.

a) Is it in fact reserved and therefore illegal as a query param?

b) is there a list of other such reserved words which, if used as a query string param, will be ignored?

a) no, there is no magic keyword pollresponse for rails.

b) make sure

  1. none of the gems/plugins that you are using in your rails-app somehow messes with your params-hash.
  2. you don't use the keyword somewhere in your code
  3. you don't have a model, resource, whatever named exaclty the same, cause this might cause some confusion in rails

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