On Fri, Aug 20, 2010 at 2:01 PM, Carl Jenkins <[email protected]> wrote: > I am going through the Depot application tutorial in the Agile book and > have a question... > > How is that I can put a reference to my model (i.e. @products = > Produts.all) in my store controller (or any other for that matter) and > it just "knows" about it. > > To me that seems a lot like global variables which I thought were a > no-no. > I would expect a require statement at the top or something like that.
In Rails, all controllers know about all models. The controllers are just a way to namespace your app into separate logical pieces. When you do Product.all, Product is a class where all your model methods live, it has nothing to do with any controllers. In Ruby, global variables begin with $. -- Greg Donald destiney.com | gregdonald.com -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

