Check what is comming in param

hi guys

i am checking with params[:a].nil? and params[:a].blank?

but in the url a is not coming but for some other purpose service i am
using
the same a for some other service

if some params is nit coming in url how to check

guide me


Karthik.k
Mobile - +91-9894991640

Karthik Kantharaj wrote:

hi guys

i am checking with params[:a].nil? and params[:a].blank?

but in the url a is not coming but for some other purpose service i am
using
the same a for some other service

if some params is nit coming in url how to check

guide me


Karthik.k
Mobile - +91-9894991640

One purpose, one name.
Once your code is free from ambiguity, it’ll be easier to help you.

2009/8/26 karthik k [email protected]:

hi guys

i am checking with params[:a].nil? and params[:a].blank?

but in the url a is not coming but for some other purpose service i am using
the same a for some other service

if some params is nit coming in url how to check

I don’t understand the question. If a is not in the url then
params[:a] will be nil as you say. Please explain more in what way
this does not work for you.

Colin

Colin L. wrote:

I don’t understand the question. If a is not in the url then
params[:a] will be nil as you say. Please explain more in what way
this does not work for you.

Colin

“I am checking with params[:VARNAME].nil? and params[:VARNAME].blank?.
My problem is that I use a variable VARNAME for some other purpose as
well. How can I tell?”

I mean, you COULD check the format of the VARNAME, but if it’s two
similar hashes, you’re out of luck anyway. Best to rename one of them so
there’s no ambiguity, and then the problem goes away.

2009/8/26 Aldric G. [email protected]:

well. How can I tell?"
It does not matter if you have a variable called varname (don’t use
VARNAME, upper case implies a constant in ruby). params[:varname]
checks whether the params hash contains an entry for the key varname
and is not affected by any variable called varname.

Colin L. wrote:

It does not matter if you have a variable called varname (don’t use
VARNAME, upper case implies a constant in ruby). params[:varname]
checks whether the params hash contains an entry for the key varname
and is not affected by any variable called varname.

Okay, sorry. I was worried about being english-readable and I became
ruby-unreadable.

I -think- he is saying that he has:
params[:varname] … And params[:varname] may exist for some other
purpose but not the purpose he needs, so he wants to make sure it’s the
params[:varname] he wants. Does that make sense?
Yeah, it doesn’t make sense to me either. That’s why I suggested only
passing parameters with unique names.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs