FactoryGirl.define do factory :postcode, class:Hash do id { Faker::Address::postcode } initialize_with { attributes } end end