hi guys i have a form which has an element, "category id".
When i submit it with values, i can see param(:category) with a value (as i print out that value in the controller's method. Anyway, when i submit my form without selecting any category, the method in the controller does not pick up on it. I tried using .nil? but it doesn't work. This is my code: def get_subcategories if params[:category] puts " I M in GET SUBCATEGORIES -" + params[:category] + '...' @category = Category.find(params[:category]) @sub_categories = @category.sub_categories.all else puts "no given category id to retrieve the subcategory" end end When i run the application and submit without a category value , i notice that params[:category] is still defined (hence printing out "I M in GET SUBCATEGORIES") when it should not be. I have even tried "params[:category].nil?" Any ideas? In perl, i could test the variable for truth (IE if ($params->{'category'}) then ... --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---