# Demo environment more strict than development one

**URL:** <https://www.ruby-forum.com/t/demo-environment-more-strict-than-development-one/114903>\
**Category:** Rails\
**Created:** [September 18, 2007, 5:54pm UTC](https://www.ruby-forum.com/t/demo-environment-more-strict-than-development-one/114903 "2007-09-18T17:54:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Karine\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/e99b99/32.png) [@Karine\_D](https://www.ruby-forum.com/u/Karine_D)\
**Post date:** [September 18, 2007, 5:54pm UTC](https://www.ruby-forum.com/t/demo-environment-more-strict-than-development-one/114903/1 "2007-09-18T17:54:47Z")

</div>

Hello,

I’m writing a Rails application on my home computer. I update it from  
time to time to a demo server.

The demo server complains a lot, while I didn’t have any problems at  
home. Whenever I iterate over an empty collection, like :

controller:  
@keyword\_groups = KeywordGroup.find(:all)

view:  
\<%= render :partial =\> “keyword\_group”, :collection =\> @keyword\_groups  
%\>

partial:  
\<%= link\_to keyword\_group.label, :action =\> ‘show\_keyword\_group’, :id  
=\> keyword\_group %\>

If the keyword\_groups table is empty, this works fine at home, but  
doesn’t work on the demo server:

ActionView::TemplateError (undefined method `label’ for nil:NilClass)  
on line #4 of app/views/user/\_keyword\_group.rhtml:

I’d like to be sure my app will work anywhere, so how can I make my  
development environment as much strict as the demo one? Is that just a  
configuration option?

Thanks,  
Karine D.

---

<div class="post-metadata">

**Author:** ![Karine\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/e99b99/32.png) [@Karine\_D](https://www.ruby-forum.com/u/Karine_D)\
**Post date:** [September 19, 2007, 10:13am UTC](https://www.ruby-forum.com/t/demo-environment-more-strict-than-development-one/114903/2 "2007-09-19T10:13:05Z")

</div>

Karine D. wrote:

> ActionView::TemplateError (undefined method `label’ for nil:NilClass)  
> on line #4 of app/views/user/\_keyword\_group.rhtml:
> 
> I’d like to be sure my app will work anywhere, so how can I make my  
> development environment as much strict as the demo one? Is that just a  
> configuration option?
> 
> Thanks,  
> Karine D.

There’s an environment config parameter called “config.whiny\_nils”. By  
default in your config/environments/development.rb file you’ll see it  
set to “true”. It looks like your home machine is running in production  
mode but your demo server is running in development mode.

–  
Michael W.

---

<div class="post-metadata">

**Author:** ![Karine\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/e99b99/32.png) [@Karine\_D](https://www.ruby-forum.com/u/Karine_D)\
**Post date:** [September 19, 2007, 6:18pm UTC](https://www.ruby-forum.com/t/demo-environment-more-strict-than-development-one/114903/3 "2007-09-19T18:18:00Z")

</div>

On Wed, 19 Sep 2007 01:12:23 -0700  
Michael W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> There’s an environment config parameter called “config.whiny\_nils”.  
> By default in your config/environments/development.rb file you’ll see  
> it set to “true”. It looks like your home machine is running in  
> production mode but your demo server is running in development mode.

Thanks for your answer. Home is in development mode and Demo in  
production mode. They share the same config/ folder, where I indeed  
found config.whiny\_nils = true in development.rb

And I found out that home is as strict as demo, and throws the nil  
error to me when it stumbles upon it. So, the strictness problem wasn’t  
there, everything is configured fine, but I had just witnessed something  
strange on the demo server, that happened today on the home server, and  
that I just don’t understand…

I created a new model. New methods in my old controller to manage it,  
new views, new partials. And same error when trying to render the  
partial on the empty collection (this time the error did happen on my  
home server so I could verify that it is indeed as strict as demo).

The very strange thing is that, if in the partial I replace:  
\<%= link\_to book.title, :action =\> ‘show\_book’, :id =\> book %\>

with:  
\<%= link\_to book.title, :action =\> ‘show\_book’, :id =\> book if book %\>

there is no more nil error for sure, but I see an empty partial (there  
is a static image in that partial, and I see one in the view where I  
render the partial on the @books collection) while the @books  
collection is empty (I checked its length, it is 0). How can that  
happen?

Thanks,  
Karine D.

---

<div class="post-metadata">

**Author:** ![Karine\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/e99b99/32.png) [@Karine\_D](https://www.ruby-forum.com/u/Karine_D)\
**Post date:** [September 20, 2007, 9:54am UTC](https://www.ruby-forum.com/t/demo-environment-more-strict-than-development-one/114903/4 "2007-09-20T09:54:27Z")

</div>

On Wed, 19 Sep 2007 18:21:23 +0200  
Karine D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> there is no more nil error for sure, but I see an empty partial (there  
> is a static image in that partial, and I see one in the view where I  
> render the partial on the @books collection) while the @books  
> collection is empty (I checked its length, it is 0). How can that  
> happen?

Forget it, I’m stupid for sure, typo in the collection name…  
Everything is fixed 🙂

Karine D.
