I'm just getting into ror and am reading lots of books on it right now. However, I ahve this question which I ahve been unable to solve. It's in regard to Views/Controllers. Inside a Person view I have the snippet "<%= Home.find_by_id(home_id).type%>". Now, in books I've been reading, they write similar things only they'd be using an instance variable in the related Person controller and then calling that instance variable from the view (like "<= @homeType=>". Is that what I should be doing instead? Why? It would seem that doing it the way I was at first above, I am saving it from having to create a usless variable and taking up more memory space (however minimal it may be). Also, Looking at the first code above, why can I access the Home controller from inside the Person View (I assume that's what I'm doing with that as I'm still trying to understand all of this dynamic relationship stuff). Thanks for any help provided!
Your point about saving memory is valid, but the whole idea of MVC is that the view, as far as possible should not contain any business logic or otherwise be strongly coupled to your data. In other words, it doesn't and shouldn't need to know where homeType comes from, it should just display it as and when required.
If you use an instance variable you can make major changes to the code which gives the value of homeType and your view need not change. All in all it outweighs the value of saving a couple bytes of memory.
Hope this helps,
Matt.