# Check existence of variable or object

**URL:** <https://www.ruby-forum.com/t/check-existence-of-variable-or-object/145285>\
**Category:** Rails\
**Created:** [August 7, 2008, 2:35pm UTC](https://www.ruby-forum.com/t/check-existence-of-variable-or-object/145285 "2008-08-07T14:35:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![shuaib85](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bbce88/32.png) [@shuaib85](https://www.ruby-forum.com/u/shuaib85)\
**Post date:** [August 7, 2008, 2:35pm UTC](https://www.ruby-forum.com/t/check-existence-of-variable-or-object/145285/1 "2008-08-07T14:35:15Z")

</div>

Dear

I have faced a new type of problem

I pass params[:place] as POST in a url like localhost:3000/navigate

if you press on the button to navigate, it will redirect you to this  
like, but if you type the link and press enter, this error will be  
displayed

You have a nil object when you didn’t expect it!  
You might have expected an instance of ActiveRecord::Base.  
The error occurred while evaluating nil.[]

I believe the whole object does not exist because i checked it using  
params[:place].blank?, i still get the same error.

any idea

thanks

---

<div class="post-metadata">

**Author:** ![shuaib85](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bbce88/32.png) [@shuaib85](https://www.ruby-forum.com/u/shuaib85)\
**Post date:** [August 7, 2008, 4:37pm UTC](https://www.ruby-forum.com/t/check-existence-of-variable-or-object/145285/2 "2008-08-07T16:37:14Z")

</div>

thanks  
it worked

---

<div class="post-metadata">

**Author:** ![shuaib85](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bbce88/32.png) [@shuaib85](https://www.ruby-forum.com/u/shuaib85)\
**Post date:** [August 7, 2008, 4:08pm UTC](https://www.ruby-forum.com/t/check-existence-of-variable-or-object/145285/3 "2008-08-07T16:08:31Z")

</div>

On Thu, Aug 7, 2008 at 2:34 PM, Shuaib85 [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I believe the whole object does not exist because i checked it using  
> params[:place].blank?, i still get the same error.

try:

if params[:place]
