# Stupid question. I'm in deadend

**URL:** <https://www.ruby-forum.com/t/stupid-question-im-in-deadend/125927>\
**Category:** Rails\
**Created:** [January 13, 2008, 9:52pm UTC](https://www.ruby-forum.com/t/stupid-question-im-in-deadend/125927 "2008-01-13T21:52:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sublime](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/cab0a1/32.png) [@sublime](https://www.ruby-forum.com/u/sublime)\
**Post date:** [January 13, 2008, 9:52pm UTC](https://www.ruby-forum.com/t/stupid-question-im-in-deadend/125927/1 "2008-01-13T21:52:03Z")

</div>

I’m newbie. Please, help. I suppose it’s easy 🙂  
I have admin controller which is working ok and with usual controller  
I  
have trouble.  
This is app/controllers/team\_controller.rb

* * *

class TeamController \< ApplicationController  
def show  
@team = Team.find(params[:id])  
end  
end

* * *

And in app/controllers/admin/teams\_controller.rb “Show” function is  
absolutely same. Then, app/views/admin/teams/show.rhtml looks like  
\<% for column in Team.content\_columns %\>

\<% if column.human\_name != "Image" %\> **\<%= column.human\_name %\>:** \<%=h @team.send(column.name) %\> \<% else %\> \<%= image\_tag url\_for\_file\_column :"team", :"image" %\> \<% end %\>

\<% end %\> But when I try to use this code in app/views/team/show.rhtml I get an error: " Showing app/views/team/show.rhtml where line #6 raised: You have a nil object when you didn't expect it! You might have expected an instance of Array. The error occurred while evaluating nil.split"

---

<div class="post-metadata">

**Author:** ![sublime](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/cab0a1/32.png) [@sublime](https://www.ruby-forum.com/u/sublime)\
**Post date:** [January 13, 2008, 10:16pm UTC](https://www.ruby-forum.com/t/stupid-question-im-in-deadend/125927/2 "2008-01-13T22:16:43Z")

</div>

On Jan 13, 2008, at 3:51 PM, sublime wrote:

> * * *
> 
> And in app/controllers/admin/teams\_controller.rb “Show” function is  
> absolutely same.

Are you defining Admin::TeamsController in that file?

> But when I try to use this code in app/views/team/show.rhtml I get an  
> error:  
> " Showing app/views/team/show.rhtml where line #6 raised:  
> You have a nil object when you didn’t expect it!  
> You might have expected an instance of Array.  
> The error occurred while evaluating nil.split"

I assume that @team.image is perhaps nil?

Try this and see if you begin to understand what your code is doing:

\<% if column.human\_name != “Image” %\>  
**\<%= column.human\_name %\>:** \<%=h @team.send(column.name) %\>  
\<% elsif @team.image.nil? %\>  
Oops! The image is nil  
\<% else %\>  
\<%= image\_tag url\_for\_file\_column :“team”, :“image” %\>  
\<% end %\>

You really should understand what’s happening with the scaffold code  
(and replace it with your actual code, scaffolding isn’t meant to be  
permanent!) before you go inviting plugins like file\_column to the  
party.

-Rob

Rob B. [http://agileconsultingllc.com](http://agileconsultingllc.com)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![sublime](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/cab0a1/32.png) [@sublime](https://www.ruby-forum.com/u/sublime)\
**Post date:** [January 13, 2008, 10:25pm UTC](https://www.ruby-forum.com/t/stupid-question-im-in-deadend/125927/3 "2008-01-13T22:25:39Z")

</div>

Thanks a lot. One check made role.  
P.S. plugin also is working fine 😉 But to get it working I spent a  
lot of time
