Sha256: 5c47d0ec49c0379c18e16ac6eb633daa7f27446dcd1ece0aa4e95e60ff6918b4
Contents?: true
Size: 395 Bytes
Versions: 155
Compression:
Stored size: 395 Bytes
Contents
module FactoryGirl class << self attr_accessor :aliases #:nodoc: end self.aliases = [ [/(.+)_id/, '\1'], [/(.*)/, '\1_id'] ] def self.aliases_for(attribute) #:nodoc: aliases.collect do |params| pattern, replace = *params if pattern.match(attribute.to_s) attribute.to_s.sub(pattern, replace).to_sym end end.compact << attribute end end
Version data entries
155 entries across 100 versions & 7 rubygems