sudo apt install zsh-autosuggestions zsh-syntax-highlighting zsh
I've been following this blog post on how to set up an api-only Rails 5 application. One of the sections talks about creating a subdomain for your api
Rails.application.routes.draw do
constraints subdomain: "api" do
scope module: "api" do
I suppose you already installed homebrew nad have one current version of node installed.
Reference taken from https://gist.github.com/kugaevsky/68a7fa894551da9c310a
First, add an older formula of node:
$ cd /usr/local
$ git checkout b64d9b9c431642a7dd8d85c8de5a530f2c79d924 Library/Formula/node.rb
$ brew unlink node
An introduction to curl
using GitHub's API.
Makes a basic GET request to the specifed URI
curl https://api.github.com/users/caspyin
# Model | |
class Meeting < ActiveRecord::Base | |
scope :date_range, lambda {|*args| where("start_date between ? and ?", args.first, args.last) } | |
end | |
#Controller | |
# fullcalendar.js dates displays | |
def meeting_dates | |
start_range = params[:start].present? ? Time.at(params[:start].to_i) : Date.civil(Time.now.year, Time.now.month, 1) |
By default, Rails applications build URLs based on the primary key -- the id
column from the database. Imagine we have a Person
model and associated controller. We have a person record for Bob Martin
that has id
number 6
. The URL for his show page would be:
/people/6
But, for aesthetic or SEO purposes, we want Bob's name in the URL. The last segment, the 6
here, is called the "slug". Let's look at a few ways to implement better slugs.
gem 'pg' | |
group :development do | |
gem 'ruby-debug' | |
end | |
gem 'rake', '~> 0.8.7' | |
gem 'devise' | |
gem 'oa-oauth', :require => 'omniauth/oauth' | |
gem 'omniauth' | |
gem 'haml' | |
gem 'dynamic_form' |