Skip to content

Instantly share code, notes, and snippets.

Ruud Seydel ruuts

Block or report user

Report or block ruuts

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@romansklenar
romansklenar / 20131118172653_create_transactional_items_view.rb
Last active Jul 3, 2017
Using PostgreSQL's materialized views as background for ActiveRecord models for flexible statistics
View 20131118172653_create_transactional_items_view.rb
# db/migrate/20131118172653_create_transactional_items_view.rb
class CreateTransactionalItemsView < ActiveRecord::Migration
def up
select_sql = File.open("#{Rails.root}/db/migrate/20131118172653_create_transactional_items_view.sql", 'r') { |f| f.read }
# for materialized view:
view_sql = "CREATE MATERIALIZED VIEW transactional_items AS (#{select_sql})"
# for normal view:
view_sql = "CREATE VIEW transactional_items AS (#{select_sql})"
@luislavena
luislavena / Rakefile
Created May 18, 2012
How to send exception information from Rake tasks to Exceptional.io
View Rakefile
# before tasks/rails
require "rake/exceptional"
View shared_connection.rb
# In your test_helper.rb
class ActiveRecord::Base
mattr_accessor :shared_connection
@@shared_connection = nil
def self.connection
@@shared_connection || retrieve_connection
end
end
You can’t perform that action at this time.