Skip to content

Instantly share code, notes, and snippets.

View kazpsp's full-sized avatar
🎯
Focusing

rodrigo zurek kazpsp

🎯
Focusing
View GitHub Profile
@kazpsp
kazpsp / passwords_controller.rb
Created August 14, 2012 16:40 — forked from guilleiguaran/passwords_controller.rb
StrongParameters with Devise
# app/controllers/users/password_controller.rb
class Users::PasswordsController < Devise::PasswordsController
def resource_params
params.require(:user).permit(:email, :password, :password_confirmation)
end
private :resource_params
end
Model
scope :sort_by_client_name_asc, order('client_name ASC')
scope :sort_by_client_name_desc, order('client_name DESC')
View
sort_link @search, :sort_by_custom_name_asc
@kazpsp
kazpsp / gist:6226710
Last active December 21, 2015 01:19
class Fixtables < ActiveRecord::Migration
def self.up
change_column :table_name, :column_name, :newtype
change_column :table_name, :column_name2, :newtype
change_column :table_name2, :column_name, :newtype
end
def self.down
change_column :table_name, :column_name, :oldtype
change_column :table_name, :column_name2, :oldtype
change_column :table_name2, :column_name, :oldtype

Upgrading Ruby using RVM on Digital Ocean's Ruby on Rails on Ubuntu 14.04 (Nginx + Unicorn) Image

For those out there more advanced, this is probably not worth reading. However, if you’re fairly new to system admin on a Digital Ocean Ubuntu/Nginx/Unicorn/MySQL/Ruby on Rails setup, it may help you out. Recently, I needed to upgrade my ruby version from 2.0.0-p353 to version 2.2.0 on my Digital Ocean droplet. I felt like this would be fairly easy to do since RVM comes installed with the ‘Ruby on Rails on 14.04 (Unicorn + Nginx)’ image that Digital Ocean provides under the ‘Applications’ tab when creating a Droplet.

While it is true that installing a new version of ruby using RVM on your system is fairly easy, there’s a few locations that you MUST change in order to use the new ruby version. This is where if you are unfamiliar or new to this, you could spend a decent amount of time digging for these. Hopefully this will save you the time and make your upgrade fairly smooth.

Let’s get started!

Step 1: Tak