Sha256: d53a8e1f58c5f0ae5605786138770bb63425a5efdf226b817008b27e4cc5f9c4
Contents?: true
Size: 352 Bytes
Versions: 9
Compression:
Stored size: 352 Bytes
Contents
module FactoryBot 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
9 entries across 9 versions & 1 rubygems