2009/8/26 Aldric Giacomoni <[email protected]>: > > Colin Law 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?"
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. > > 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. > -- > Posted via http://www.ruby-forum.com/. > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

