Skip to content

Instantly share code, notes, and snippets.

View jmwelch's full-sized avatar

Jared Welch jmwelch

View GitHub Profile
JS_PATH = "app/assets/javascripts/**/*.js";
Dir[JS_PATH].each do |file_name|
begin
Uglifier.compile(File.read(file_name))
print '.'
rescue
puts "\n#{file_name}"
end
end
@jmwelch
jmwelch / models.rb
Last active February 23, 2017 23:10
Multiple Joins with Foreign Keys
class User < ApplicationRecord
has_many :created_budgets, class_name: "Budget", foreign_key: "creator_id"
has_many :client_budgets, class_name: "Budget", foreign_key: "client_id"
end
class Bugdet < ApplicationRecord
belongs_to :creator, class_name: "User"
belongs_to :client, class_name: "User"
end