Sha256: 46270f2888d1ae0a9a95785fd0d2f4ba52720a0008c4e6cced8a4d855a435a58
Contents?: true
Size: 352 Bytes
Versions: 113
Compression:
Stored size: 352 Bytes
Contents
module FactoryGirl class << self attr_accessor :aliases end self.aliases = [ [/(.+)_id/, '\1'], [/(.*)/, '\1_id'] ] def self.aliases_for(attribute) aliases.map do |(pattern, replace)| if pattern.match(attribute.to_s) attribute.to_s.sub(pattern, replace).to_sym end end.compact << attribute end end
Version data entries
113 entries across 100 versions & 12 rubygems