Skip to content

Instantly share code, notes, and snippets.

@raghubetina
raghubetina / starter_generators.md
Last active December 25, 2017 20:54
starter_generators Cheatsheet

starter_generators Cheatsheet

Include this in Gemfile, which is a file located in the root folder of your app:

# Gemfile

gem "starter_generators", :git => "http://github.com/raghubetina/starter_generators.git"
@raghubetina
raghubetina / devise.md
Last active July 13, 2019 20:35
Devise Cheatsheet

Authentication and Authorization with Devise

We will be using the [Devise gem][2] to help us get started with authentication (are you who you say you are?) and authorization (are you allowed to do/see this?).

Add sign-in/sign-out

  • Add gem 'devise' to your Gemfile and bundle
  • rails g devise:install

Devise will give you some setup instructions. We don't need to worry about most of them, but we do need to set a root URL. Usually, you will point the root URL to the index action of some important resource in your application: In config/routes.rb:

@raghubetina
raghubetina / github.md
Last active August 7, 2021 14:47
Getting Started With GitHub

Getting Started With GitHub

Pulling Code Down from GitHub.com

We're going to use GitHub for all of our code-sharing and submission.

Vocab

All of our apps are just a folder with some files (maybe some HTML files, some CSS files, etc) and other folders in it. We call the top-level folder a "repository". You'll find the list of the repositories we'll work on during this course on the organization page (your course org is probably called something like appdevwinter2017):

@raghubetina
raghubetina / heroku.md
Last active January 5, 2024 04:40
Heroku Cheatsheet

Heroku Cheatsheet

Get the Heroku toolbelt

Sign up for a Heroku account and install the toolbelt if you haven't already.

Prepare your application

In your Gemfile, add

@raghubetina
raghubetina / command_line.md
Last active December 25, 2017 20:52
Command Line Cheatsheet

Command Line Cheatsheet

See what folder you are currently in

Mac

The "print working directory" command:

@raghubetina
raghubetina / rails_basics.md
Last active December 25, 2017 20:53
Rails Basic Commands

Rails Basic Commands

Generate or Clone an application

Generate a brand new application

cd to the folder where you want to store your new application. For me, this is ~/code. Then,

rails new my_app
@raghubetina
raghubetina / rcav.md
Last active December 25, 2017 20:53
RCAV Flowchart

RCAV Flowchart

Our apps are nothing more than a collection of URLs that we decide to allow users to access:

  • mydomain.com/products
  • mydomain.com/photos/193
  • mydomain.com/signin

So remember: everything always starts with a route between a URL we want to support and a Ruby method that will be responsible for generating a response to the user's browser.

@raghubetina
raghubetina / ransack.md
Last active May 31, 2024 16:36
Ransack Cheatsheet

Ransack Cheatsheet

The Ransack gem provides us with a powerful, flexible, easy-to-integrate search/filter form.

Installation

In your Gemfile, include

gem 'ransack'
@raghubetina
raghubetina / activeadmin.md
Last active April 5, 2020 12:56
ActiveAdmin Cheatsheet

ActiveAdmin Cheatsheet

The ActiveAdmin gem provides us with a entirely separate administrative sub-site. It's amazingly full-featured out of the box, and also is extremely customizable.

Installation

In your Gemfile, include

gem 'activeadmin', '~> 1.0.0.pre4'
@raghubetina
raghubetina / carrierwave.md
Last active December 6, 2018 13:15
CarrierWave Cheatsheet

CarrierWave Cheatsheet

The CarrierWave gem provides us with an easy way to allow file uploads through forms.

Installation

In your Gemfile, include

gem 'carrierwave'