Tutorial by Examples

This example assumes Ruby and Ruby on Rails have already been installed properly. If not, you can find how to do it here. Open up a command line or terminal. To generate a new rails application, use rails new command followed by the name of your application: $ rails new my_app If you want to c...
Rails uses sqlite3 as the default database, but you can generate a new rails application with a database of your choice. Just add the -d option followed by the name of the database. $ rails new MyApp -T -d postgresql This is a (non-exhaustive) list of available database options: mysql oracle...
To generate a controller (for example Posts), navigate to your project directory from a command line or terminal, and run: $ rails generate controller Posts You can shorten this code by replacing generate with g, for example: $ rails g controller Posts If you open up the newly generated app/...
From guides.rubyonrails.org: Instead of generating a model directly . . . let's set up a scaffold. A scaffold in Rails is a full set of model, database migration for that model, controller to manipulate it, views to view and manipulate the data, and a test suite for each of the above. Here's a...
Rails is shipped by default with ActiveRecord, an ORM (Object Relational Mapping) derived from the pattern with the same name. As an ORM, it is built to handle relational-mapping, and more precisely by handling SQL requests for you, hence the limitation to SQL databases only. However, you can stil...
This example assumes that you have experience in creating Rails applications. To create an API-only app in Rails 5, run rails new name-of-app --api Add active_model_serializers in Gemfile gem 'active_model_serializers' install bundle in terminal bundle install Set the ActiveModelSeriali...
Installing Rails on Ubuntu On a clean ubuntu, installation of Rails should be straight forward Upgrading ubuntu packages sudo apt-get update sudo apt-get upgrade Install Ruby and Rails dependecies sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyam...

Page 1 of 1