hello everybody, i am new to ROR i have some doubts 1> will u tell me that what Convention over configuration what i mean is which configurations are avoided and what conventions we use in ROR 2>DRY principle->dont repeat yourself whats it is exactly what kind of repeations are avoided Thank u
on 2007-04-09 16:03
on 2007-04-10 00:18
rajdeep wrote: > hello everybody, i am new to ROR i have some doubts > 1> will u tell me that what Convention over configuration > what i mean is which configurations are avoided and what conventions > we use in ROR > > 2>DRY principle->dont repeat yourself whats it is exactly what kind of > repeations are avoided > > Thank u 1) Conventions like how to name your database tables. Every table has an id column, and association foreign keys are the name of the associated table + _id (i.e. product_id). Other things like the naming of files. If you have a controller called 'Foo' and an action named 'bar', then the view for that action will be in /app/views/foo/bar.rhtml These conventions allow you to link your app together with very little explicit and repetitive code that describes those links. It just works because the framework is intelligent enough to figure out what you want to do because you are following a logical path. 2) Rails aims to get rid of the copy & paste style programming. Any programming is prone to snippets of code that are close, or even the same, but in different places of your code. Rails (and Ruby) make it easy to abstract your logic into smaller and more reusable chunks.