Skip to content

Instantly share code, notes, and snippets.

@voluntas
voluntas / webrtc.rst
Last active October 29, 2024 04:43
WebRTC コトハジメ
@iorionda
iorionda / to_factory_girl.rb
Created August 20, 2013 01:56
rails console で [email protected](main)> model.first.to_fg
class ActiveRecord::Base
def to_factory_girl
ignores = %w(id created_at updated_at)
array = []
array << "FactoryGirl.define do"
array << " factory :#{self.class.model_name.underscore} do"
attributes.each do |key, value|
next if ignores.include?(key)
if key =~ /_id$/
array << " association :#{key.gsub(/_id$/, '')}"