Jun 24, 2019 11:58 PM
(This post was last modified: Jun 24, 2019 11:59 PM by Rubymine.)
Hello Everyone
In this little thread, i wanna giving short tutorial to start using Ruby On Rails as Web application. I hope you enjoy it.
![[Image: ruby-on-rails-512.png?w=256&h=256]](https://rubyisthome.files.wordpress.com/2019/06/ruby-on-rails-512.png?w=256&h=256)
In this little thread, i wanna giving short tutorial to start using Ruby On Rails as Web application. I hope you enjoy it.
![[Image: ruby-on-rails-512.png?w=256&h=256]](https://rubyisthome.files.wordpress.com/2019/06/ruby-on-rails-512.png?w=256&h=256)
- 🤝 Table of Content 🤝
👹 About Rails
What is Ruby on Rails
Who famous app made by it
Why Rails
- 👹 Getting Started
What the hell is MVC , ORM ? 🎉
Installing Rails
Build you Little App
- 👹 Making a mini stuff
Blog CRUD
About Rails
1. What is Ruby on Rails
Ruby on Rails , "RoR" / "Rails" for short. is a Full-stack Web Framework using Ruby programming language as base, Founded by David Heinemeier Hansson ( DHH ) and license with MIT License
2. Who Famous app using Rails
Web app like GitHub , GitLab , Twitter and Shopify they uses Ruby on Rails in their codebase, but not just ruby on their code , of course using combination of many language with microservices implementation.
3. Why Rails
I no had many reason to choosing rails , i just select it because it use Ruby . but as long i use it , i can comparing Rails had fast development speed and many magic in there : Auto Generate , Simplify CRUD. The main intention is write less and edit more from app skeleton.
Getting Starting
1. What the hell is MVC , ORM ?
MVC is shorted from "Model-View-Controller" , breakdown you application into 3 consent layer . Model consent for handling database business , View handling consent for Front-page : HTML,CSS and JS , Controller consent for connecting Model and View section and place you logic here. The benefit of this paradigm you have code which had single responsibility with it action and ease to understand with team work , once you understand MVC.
ORM is short for "Object Relational Mapping", This method to turn you database table in class object which representation of your table on database , just call method to do your database transaction.
2. Installing Rails
This little difficult for me to explain , but you need system dependencies -- which mean you need installing on you operating system.
the system dependencies : gcc , ruby development library , nodejs , libsqlite3.
If you use arch linux you can simply following this :
Code
pacman -S base-devel nodejs ruby-dev
gem install bundler railsif you windows better you try linux , installing using cygwin then follow archlinux command.
if you mac , ruby bundled with you OS ,so just :
Code
gem install rails3 . Building you first app
in this you just build skeleton of you web application , which mean just a place for you generate all MVC scheme you need.
Code
rails new < your app name here >< you app name here > replace this , with you application name.
then get into you < you app name here > directory.
to measure it working or not , run it
Code
rails s[b]Making you mini aplication[/b]
1. Blog CRUD
make sure you follow previous article , i just generate scaffold -- is full MVC generation to provide CRUD action on you app.
Code
rails generate scaffold Blog title:text content:text
rake db:migrate
rails srails generate scaffold <Table Name> <Column On Database>
scaffold need parameter to pass, it is Table name and Column inside it.
rake db:migrate
work for populate generated model scheme on db/schema to database , and used by model.
rails s
starting you server.
we had generate scaffold . to access it , open browser with this address : <localhost:3000>/<Scaffold Table Name> -- localhost:3000/Blog.
for more resource you can visit:
Ruby on Rails Guides
Derek Banas on YouTubes
[Reversed , for future improvement ]


