1 Reply Latest reply on Jun 11, 2012 11:56 AM by Arquimidez Mora

    Rhom and folder names

    Gerbrand Stap

      When a Rhom model is generated, all files are placed in a folder with the name of the model. These files include the data object, controller and some views. This is a nice start, but a real life app is mostly not this straight forward. Views will often contain data from several models, so I created a folder, put some data objects in it and tried to use them. But I could not get this working. After a lot of trying, I discovered that the name of the folder seems to be crucial. A model named 'Product' must be placed in a folder 'Product'. Even putting a "require 'data_objects/product'" does not solve the problem and I keep getting errors like 'undefined method `create' for Product:Class'.

       

      So my question is: Is it a requirement that a Rhom model is placed in a folder with the same name as the model (under the 'app' folder)?

      If it is not, how can I use it in a controller when placed in another folder?

        • Re: Rhom and folder names

          Hi,

           

          It is important to place the Models inside a folder with its name because Rhodes works on the local browser

          and when it search for a page or an action in the controller, it search "/app/Product/new", "/app/Product/show",

          "/app/Product/{108649082871210.95}/delete" where {108649082871210.95} is the id on the local database or "/app/Product/any_other_method_or_view"

           

          Also, you can call a Model from another, for example, you could be on a model store and do something like that

           

          products = Product.find(:all, :conditions => {"store" => @store.object})