29
Mar
Getting Started Ruby On Rails MVC With Fun
- Category:
- Ruby on Rails
Posted On : March 29, 2013
| No Comment
“Rails may be an internet application framework running on the Ruby programming language. If you’ve got no previous expertise with Ruby, you may realize a really steep learning curve diving straight into Rails.”
Rails may be an internet application development framework written within the Ruby language. It’s designed to create programming internet applications easier by creating assumptions regarding what each developer has to start. It permits you to put in writing less code whereas accomplishing quite several different languages and frameworks. Toughened Rails developers additionally report that it makes internet application development a lot of fun.
Rails is contracted code. It makes the belief that there’s a “BEST” thanks to do things, and it’s designed to encourage that method – and in some cases to discourage optionally. If you gain data of “The Rails Way” you’ll in all probability discover an incredible increase in productivity. If you move transferred previous habits from different languages to your Rails development, and making an attempt to use patterns you learned elsewhere, you’ll have a less happy expertise.
The Rails philosophy includes many guiding principles:
- Suggests DRY (Don’t Repeat Yourself) that writing constant code over and another time is also a dangerous issue.
- Convention Over Configuration – means Rails makes assumptions regarding what you would like to try to and the way you’re getting to have a go at it, instead of requiring you to specify each very little issue through endless configuration files.
- REST (Representational State Transfer) is that the best pattern for net applications – organizing your application around resources and customary hypertext transfer protocol verbs is that the quickest thanks to go.
The MVC design
At the core of Rails is that the Model, View, Controller design, typically simply known as MVC.
MVC advantages include:
- Isolation of business logic from the interface
- Ease of keeping code DRY (Don’t Repeat Yourself)
- Making it clear wherever differing kinds of code belong for easier maintenance
MVC outline (Summary):
This is quite a telegraphic summary of MVC. I extremely suggest that you just scan informed this subject, because it is that the key to cracking Rails. This text from higher explained.com may be a nice resource for learning MVC in Rails. However, the simplest thanks to learn is, install the framework and begin twiddling with it.
MVC – Models:
A model represents knowledge} (data) of the applying and also the rules to control that data. Within the case of Rails, models square measure primarily used for managing the foundations of interaction with a corresponding information table. In most cases, every table in your information can correspond to at least one model in your application. The majority of your application’s business logic is going to be targeted within the models.
MVC – Views
Views represent the interface of your application. In Rails, views square measure usually HTML files with embedded Ruby code that perform tasks connected only to the presentation of the information. Views handle the task of providing information to the online browser or different tool that’s accustomed create requests from your application.
MVC – Controllers
Controllers offer the “glue” between models and views. In Rails, controllers square measure to blame for process the incoming requests from the online browser, interrogating the models for information, and spending that information on to the views for presentation.
Know more about Ruby on Rails Components