Skip to content

Instantly share code, notes, and snippets.

Working from home

Mark Przepiora markprzepiora

Working from home
Block or report user

Report or block markprzepiora

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
markprzepiora / gist:61e7e6a3c06e9b573390
Created Sep 20, 2014
ActiveRecord 4.2 relationship + callback regression
View gist:61e7e6a3c06e9b573390
# Models
class Post < ActiveRecord::Base
after_save :do_something_to_tags
has_many :post_tags, inverse_of: :post
has_many :tags, through: :post_tags
def do_something_to_tags
puts "The following line in Rails 4.2 incorrectly joins on post_id = NULL"
#!/usr/bin/env bash
set -e
# copy_bower_components - A very simple bash script for copying your Bower
# components over to your rails vendor/assets folder.
# Copyright (c) 2013 Mark Przepiora
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
markprzepiora /
Last active Dec 21, 2015
One-liner for switching over to using "double" instead of "stub" to create test double, the latter of which is deprecated in RSpec 3. This should not touch actual stubbing (e.g. something.stub(awesome: true)), or stubbing of constants for example (e.g., stub_const "MyArray"...)
find spec -name '*.rb' | xargs sed -i '' -E 's/([^.]|^)stub([^_]|$)/\1double\2/g'
You can’t perform that action at this time.