Sha256: f4fef8225cd4db25df5fc4a1fd7cbb814b7f55ddebd301143e922c99ebc0d882
Contents?: true
Size: 418 Bytes
Versions: 17
Compression:
Stored size: 418 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 else nil end end.compact << attribute end end
Version data entries
17 entries across 17 versions & 3 rubygems