Generating a model in Ruby
Posted in Ruby on Rails, Web DesignIn previous articles we had discussed and introduced the principles behind the model-view-controller architectural pattern, and saw how each of the components is implemented within the Rails framework. Now lets use those knowledge on Rails’s code generation techniques to create components.
generate can be called from the command line and takes several parameters. The first parameter is the type of component that’s to be generated. You can probably guess which value I’m going to suggest you use for this parameter. We’re creating a model, so the parameter to pass is simply model. Let’s take a look at what happens when we pass that to the script: (more…)
