# Beginner's question

**URL:** <https://www.ruby-forum.com/t/beginners-question/161383>\
**Category:** Rails\
**Created:** [February 26, 2009, 2:34am UTC](https://www.ruby-forum.com/t/beginners-question/161383 "2009-02-26T02:34:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![valk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/71c47a/32.png) [@valk](https://www.ruby-forum.com/u/valk)\
**Post date:** [February 26, 2009, 2:34am UTC](https://www.ruby-forum.com/t/beginners-question/161383/1 "2009-02-26T02:34:52Z")

</div>

Hi all,  
Sorry if this question looks stupid…

In my post on edit action I have:

def edit  
@post = Post.find(params[:id],:include =\> [:ingredients,  
{:ingredients =\> :heb\_ingredient}])  
ingredients = @post.ingredients  
ing = ingredients[0] # \<-- ing is not nil  
ei = ing.eng\_ingredient # \<-- ei is not nil but it’s  
attrs are nil  
…  
end

This doesn’t work only when I execute on browser. However if I run all  
the commands thru script/console, then all the data is correct and  
present.  
What can be the problem? All the models seem to be defined correctly.

---

<div class="post-metadata">

**Author:** ![valk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/71c47a/32.png) [@valk](https://www.ruby-forum.com/u/valk)\
**Post date:** [February 26, 2009, 2:39am UTC](https://www.ruby-forum.com/t/beginners-question/161383/2 "2009-02-26T02:39:35Z")

</div>

Sorry, the previous code was wrong, anyway the problem is the same:

def edit  
@post = Post.find(params[:id],:include =\> [:ingredients,  
{:ingredients =\> :eng\_ingredient}])  
ingredients = @post.ingredients  
ing = ingredients[0] # \<-- ing is not nil  
ei = ing.eng\_ingredient # \<-- ei is not nil but it’s  
attrs are nil  
…  
end
