Isaac Sloan - Web Developer, Photographer, Musician and Citizen of Earth
Banner700

Setting up Ruby on Rails for OSX (10.10) Yosemite

March 20, 2015

Very little has changed since Mavericks but here's an updated tutorial.

Step 1: Install XCode Command Line Tools

xcode-select --install

Step 2: Install and prepare Homebrew

ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go/install)"
brew doctor
brew update

Step 3: Install rbenv

brew install rbenv ruby-build openssl
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
Setting up Ruby on Rails for OSX (10.10) Yosemite

Fixing MacVim Fullscreen in Yosemite

March 17, 2015

Many long term users of Macvim like myself have been annoyed that fullscreen mode cuts off the first couple lines and shows a bar on the right when using OSX Yosemite. After trying out multiple forks that kind of fixed it but also introduced other problems I finally found a satisfactory fix. Just run this in the terminal to turn off yosemites fullscreen method on macvim.

$ defaults write org.vim.MacVim MMNativeFullScreen 0
Fixing MacVim Fullscreen in Yosemite

Setting up an Ubuntu 14.04 Server for Rails

November 25, 2014

Step 1: Install Ubuntu

Step 2: Add a deploy user and optionally a user for yourself.

Assuming you're logged in as root add these users and login as "not root."

adduser deploy
adduser [yourname] #optionally
su - deploy # or your username. The important thing is that you use a user other than root.

Step 3: Update and Install dependencies

Setting up an Ubuntu 14.04 Server for Rails

Saving dynamic serialized fields with fields_for in Rails

February 23, 2015

Tell you model to serialize it as a struct and create a setter to build the struct on create.

# post.rb model
serialize :content, OpenStruct
def content=(v)
  self[:content] = OpenStruct.new(v)
end

Then you can add any form elements you want for content.

-#form partial

= f.fields_for :content, @post.content do |ff|
  .field
    = ff.label :name
    = ff.text_field :name
  .field
Saving dynamic serialized fields with fields_for in Rails

Petergate Authorizations

January 18, 2015

"If you like the straight forward and effective nature of Strong Parameters and suspect that cancan might be overkill for your project then you'll love Petergate's easy to use and read action and content based authorizations."

-- I proclaim optimistically

Installation

Petergate Authorizations