Open Source Starter Guide for IBM i Developers by Pete Helgren
Author:Pete Helgren
Language: eng
Format: epub
Publisher: MC Press
Published: 2017-04-04T04:00:00+00:00
Structure of a Rails Project
Figure 7.1 shows the beast you create with rails new:
Figure 7.1: Sample Rails project components
The app folder is where most of the code for your app lives. We’ll circle back to it in a second. The bin folder is where the gem wrappers (binstubs) live. These were introduced in Rails version 4 and provide a way for multiple Rails and Ruby environments to coexist. The config folder is where the configuration scripts and properties live, so that you can configure database connections, routes for your application, and a bunch of other options. The db folder is where your database schemas will live along with migrations, a cool feature of Rails that we’ll explore momentarily. The lib folder will contain extended modules for your application. The log folder will contain (right you are!) logs generated by your application. The public folder will contain static content that your base app will serve. The test folder will contain your unit tests if you decide to create them. The tmp folder will contain temporary files that your application might generate, such as cache files and PID references.
We already covered the Gemfile, but the Rakefile is something worth noting here. Rake is a task-oriented script file that will execute a series of rake commands. Rake is similar to the makefile in C in that you can set configuration options and run steps in sequence to build or modify your application. It is basically a task-automation tool.
So, back to the app folder. This folder contains subfolders for the application structure. You should immediately see the model, view, and controller folders and get a sense of what they do. model will be empty for now because we really don’t have an app designed, so no logic for it has been written. view has a layout folder in it, and that is where your .erb templates will live that apply to the entire app. This structure can get quite complex over time as partials are added for other controllers that might be created. But, generally, your templates live here. The controller folder will house the classes that control input from your users and access to your Web pages.
There are a couple of other folders in the app folder that fall outside the MVC convention. The assets folder has images, JavaScript, and CSS content that is served by your app. The helpers folder contains small sections of code that usually render a component of a page (view) so you aren’t cluttering up your controller folder. The mailers folder will contain code for your email functions should your application need them. Rails’ Action Mailer is your friend here.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Deep Learning with Python by François Chollet(12579)
Hello! Python by Anthony Briggs(9918)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9797)
The Mikado Method by Ola Ellnestam Daniel Brolund(9780)
Dependency Injection in .NET by Mark Seemann(9341)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8303)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7764)
Grails in Action by Glen Smith Peter Ledbrook(7699)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7558)
Becoming a Dynamics 365 Finance and Supply Chain Solution Architect by Brent Dawson(7104)
Microservices with Go by Alexander Shuiskov(6871)
Practical Design Patterns for Java Developers by Miroslav Wengner(6785)
Test Automation Engineering Handbook by Manikandan Sambamurthy(6729)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6420)
Angular Projects - Third Edition by Aristeidis Bampakos(6141)
The Art of Crafting User Stories by The Art of Crafting User Stories(5666)
NetSuite for Consultants - Second Edition by Peter Ries(5598)
Demystifying Cryptography with OpenSSL 3.0 by Alexei Khlebnikov(5405)
Kotlin in Action by Dmitry Jemerov(5068)
