Ruby on Rails
Jul 11, 2020
Suppose you want to remove a 'comments' table from a blog application. You can do so by performing the following tasks from the command line (e.g., Terminal). Step one: $ rails console Step two: $ ActiveRecord::Migration.drop_table(:c...
Jun 23, 2020
Issue 1 - Error in installing pg gem Installing pg 0.19.0 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /home/luke/.rvm/gems/ruby-2.4.1/gems/pg-0.19.0/ext /home/luke/.rvm/rub...
Mar 25, 2017
Mar 24, 2017
Introduction Often when developing apps with Rails you need to set up environment variables to keep sensitive information secure in your code. This article looks at how to set up environment config variables in Rails. We’ll look at why we need to...
May 05, 2016
In your application controller file app/controllers/application_controller.rb include the following private method: class ApplicationController < ActionController::Base private # Overwriting the sign_out redirect path method de...
Apr 16, 2016
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. To generate a scaffold for a blog use the rails gener...
Apr 06, 2016
Generate a controller rails generate controller "controller name" "action1 action2 action3" Delete a controller rails destroy controller "controller name" Create Model and Migration rails generate model "model name" This g...
Apr 04, 2016
Install the rbenv and Ruby dependencies sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties l...
Apr 01, 2016
Development Install Ruby Install DevKit (http://rubyinstaller.org/downloads/) gem install capistrano --no-ri --no-rdoc Deployment Machine Update the software sources list And upgrade the dated applications: aptitude update aptitud...