A super simple Ruby on Rails starter guide 1 - Only 30 mins to start!
I decided to write this entry for my friend, Ruk in return to her infinit smile & kindness in India. I hope it helps her to start studying RoR smoothly during her 10 days off :)
■ Install basic RoR app dev environment (for windows)
Download "railsinstaller" and install it. Almost all the initial setup is done by this package. Simple :) Railsinstaller +++
RailsInstaller
(If you want to use a MySQL database in your app, you need to set it up. But for the first step, Sqlite included in railsinstaller is enough.)
Now it's time to create the first RoR app :D
■ 10 minutes tutorial for the first simple app
1. at your favorite directory, create a rails app
type the following line on your command prompt. "myapp" can be replaced to you favorite app name such as "makehappy".
> rails new myapp
3. generate a set of MVC( model/view/controller) code
> rails g scaffold user name:string email:string
You can find the automatically generated codes:
- model: [your app dir]/app/models/user.rb
- controller: [your app dir]/app/controllers/users_controller.rb
- view: [your app dir]/app/views/users/xxx.html.erb (xxx = _form/edit/index/new/show)
4. create "myapp" databases
Two databases named "myapp_development" and "myapp_test" are created with the command below.
> rake db:create
6. run the app :)
> rails server
7. access to the app via your browser
You can list/create/show/edit/delete user data.
Yey, that's all for the first step! You may learn how it works by modifying the code generated in step 3.
See the official "Getting Started with Rails" guide for more detail:
Getting Started with Rails — Ruby on Rails Guides
Happy coding :D