rom-factory icon indicating copy to clipboard operation
rom-factory copied to clipboard

Allow for option to override association factory name

Open cmavromoustakos opened this issue 5 years ago • 3 comments

I have a unique problem where my Repo/Entity is called indie as in an Indie artist. The infer_factory_name(name) method https://github.com/rom-rb/rom-factory/blob/v0.6.0/lib/rom/factory/factories.rb#L203 tries looking for the Indy factory which does not exist.

cmavromoustakos avatar Dec 14 '18 03:12 cmavromoustakos

You are not alone. I'm having same issue in v0.9.0

graudeejs avatar Aug 31 '19 19:08 graudeejs

Please provide a reproduction script

solnic avatar Sep 01 '19 04:09 solnic

+1 Have same problem Simple workaround - create alias from required factory:

FactoryBot.define(:store_products) do |f|
  f.title { fake(:device, :model_name) }
  f.description { fake(:lorem, :paragraph) }
  f.timestamps
end

FactoryBot.define(store_product: :store_products) do |f|
end

FactoryBot.define(:store_product_prices) do |f|
  f.description { fake(:lorem, :paragraph) }
  f.association(:product)
  f.timestamps
end

izikaj avatar Oct 08 '19 11:10 izikaj