70 likes | 272 Views
Let’s Get on Rails. What’s Rails?. Web Development Frameworks Build on Ruby (so called Ruby on Rails) Agile Lightweight Heavily relies on Convention over configuration. Built On Some Key Principles. Rails follows some good principles MVC DRY Convention over configuration
E N D
What’s Rails? • Web Development Frameworks • Build on Ruby (so called Ruby on Rails) • Agile • Lightweight • Heavily relies on Convention over configuration
Built On Some Key Principles • Rails follows some good principles • MVC • DRY • Convention over configuration • “Unit Testing” – actually more than unit testing, though they call it that • Created bottom up – from real project, not designed by a committee
Convention Over Configuration • No heavy XML based configuration • As long as you follow convention, you need to do less work • A bit of a problem for newbies • You love it once you get used to it • You name files in a certain way, put them in specific places, … • You can deviate from conventions if you like, but the configuration is also using ruby, so fairly easy
Rails and MVC • Rails follows MVC • It actually does not simply promote MVC, it follows you home, sits with you, and makes sure you follow it • Controller receives request • You access model to manipulate data • It transfers control to a view for display Controller R O U T I N G Browser Model Business rules + data View
MVC in Rails • Convention over configuration • URL maps to an action on controller • Controller performs logic • Rails copies fields of controller to view • View generates response to be rendered • View: Action View • Controller: Action Controller • Model: Active Records
Let’s Build and Learn • We will build an application and learn about Rails, conventions, etc. using that example as a vehicle