Skip to content

Instantly share code, notes, and snippets.

@robbkidd
robbkidd / check_table_and_sequence_names.rb
Created July 27, 2012 21:52
Quick method to display the names of your PostgreSQL tables and their pkeys and sequences.
def check_table_and_sequence_names
connection = ActiveRecord::Base.connection
if connection.adapter_name == "PostgreSQL"
table_names = connection.tables.keep_if { |t| t !~ /schema_migrations/ }
table_names.map { |t| [t, connection.pk_and_sequence_for(t)].flatten }
end
end
check_table_and_sequence_names
# => [["tablename", "primarykeyname", "sequencename"]]
@robbkidd
robbkidd / gist:1085842
Created July 16, 2011 00:35
Rubinius fails to run bundle
» ruby -v
rubinius 2.0.0dev (1.8.7 4b04a866 yyyy-mm-dd JI) [i686-pc-linux-gnu]
» gem install bundler
Fetching: bundler-1.0.15.gem (100%)
Successfully installed bundler-1.0.15
1 gem installed
Installing ri documentation for bundler-1.0.15...
Installing RDoc documentation for bundler-1.0.15...
@robbkidd
robbkidd / .rubinius_last_error
Created May 18, 2011 20:57
Rubinus crash during 'bundle install' of pr_geohash
rubinius 1.2.4dev installed via RVM v1.6.5 on Ubuntu 10.10
Installing pr_geohash (1.0.0) *** glibc detected *** /home/robb/.rvm/rubies/rbx-head/bin/rbx: free(): invalid next size (fast): 0x0b617120 ***
Rubinius Crash Report #rbxcrashreport
Error: signal SIGABRT
[[Backtrace]]
/home/robb/.rvm/rubies/rbx-head/bin/rbx[0x80acf2c]
# Packaging ruby with fpm is a bit meta
# You need ruby install to use fpm
# I used an RVM install on a VM install fpm in a packaging gemset
# Install EPEL if you don't have it already
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
# Install deps for ruby build
yum install rpm-build readline-devel.x86_64 libffi-devel.x86_64 libyaml-devel.x86_64 zlib-devel.x86_64 openssl-devel.x86_64