- Intro to Fast Rails Development
- Rails Quick Start
- Rails Scaffold
- Scaffold Tour I - Resources
- Scaffold II - Forms
- User Post Relationship
- Validations & Filters
- Correct User
- Adjusting the Pages
- Header Adjustments
- Simple Twist
- 1000 Words
- Live Site on Heroku
Build a quick blog platform with Rails. (Beta tutorial.)
Rails Quick Start
Note: If you're using the starter app with test cases from the Rails contest page, you can skip this page of setup.
Ruby on Rails helps you skip lots of boilerplate code when creating a web app, but you may still find yourself repeating certain tasks when creating a new app. To get started even faster, you can clone a "starter app" that comes with various defaults set up, and/or you can use a "wizard" that generates a starter app for you.
RailsApp's Rails Composer tool does both. You can pick one of various starter apps, and it provides a short wizard of options for further customization.
The RailsApp Github page provides brief instructions for using it. To get started, enter the following code in your terminal to create a new app:
rails new your_app -m https://raw.github.com/RailsApps/rails-composer/master/composer.rb
This will generate various output and then the wizard will launch:
option Build a starter application? 1) Build a RailsApps example application 2) Contributed applications 3) Custom application
Enter 1
to start with a RailsApp starter app.
You’ll see a prompt:
option Choose a starter application. 1) learn-rails 2) rails-bootstrap 3) rails-foundation 4) rails-mailinglist-activejob 5) rails-omniauth 6) rails-devise 7) rails-devise-roles 8) rails-devise-pundit 9) rails-signup-download 10) rails-stripe-checkout 11) rails-stripe-coupons 12) rails-stripe-membership-saas
Enter 6
to get started with the Devise starter app.
The wizard will then ask you for additional options.
option Web server for development? 1) WEBrick (default) 2) Thin 3) Unicorn 4) Puma 5) Phusion Passenger (Apache/Nginx) 6) Phusion Passenger (Standalone)
Go with the default 1
.
option Web server for production? 1) Same as development 2) Thin 3) Unicorn 4) Puma 5) Phusion Passenger (Apache/Nginx) 6) Phusion Passenger (Standalone)
Since we'll be using Heroku, go with 4
, the recommended server for Heroku.
option Database used in development? 1) SQLite 2) PostgreSQL 3) MySQL
Go with 1
since it's the simplest. In the future you may want to switch to Postgresql to use the same database technology in development as the one in production.
option Template engine? 1) ERB 2) Haml 3) Slim
1
. default.
option Test framework? 1) None 2) RSpec with Capybara
1
. Nothing extra right now.
option Front-end framework? 1) None 2) Bootstrap 3.3 3) Bootstrap 2.3 4) Zurb Foundation 5.5 5) Zurb Foundation 4.0 6) Simple CSS
Previously we discussed using Skelton, a simple CSS Library. This time let's go with 2
to use the popular Bootstrap CSS framework.
option Add support for sending email? 1) None 2) Gmail 3) SMTP 4) SendGrid 5) Mandrill
For now, let's go with 1
. If you're creating a real site, you'll need to setup email later, and Mandrill is a good choice then.
option Devise modules? 1) Devise with default modules 2) Devise with Confirmable module 3) Devise with Confirmable and Invitable modules
This app uses Devise which was covered in the Gems Tutorial. We'll keep Devise simple with 1
. (Selecting 2
would require users to confirm their email to use the site.)
option Use a form builder gem? 1) None 2) SimpleForm
Select 2
to use SimpleForm a gem that lets you create forms with even less code than the Rails default form helpers. It also can add Bootstrap styles so your forms look good.
This will produce some terminal output, and then the wizard will continue.
option Install page-view analytics? 1) None 2) Google Analytics 3) Segment.io
1
. It's not hard to add analytics later when needed.
option Prepare for deployment? 1) no 2) Heroku 3) Capistrano
2
. Prepare for deployment.1
This will now generate your app and produce lots of output. When it's done, you can test it out:
- Navigate to the folder in your terminal (
cd your_app
) - Enter
rails s
to start the rails server - Open up your app at localhost:3000
You now an app with working user accounts, ready for your development!
1. We'll need to fix some code later before pushing to production.