I want to change the location of my plants, how can I get Rails to know a new place when generating?

I am using rails 3.2.0.rc1 and factory_girl_rails

I want the location of my plants to be RAILS_ROOT/factories instead of RAILS_ROOT/specs/factories

When I use Rails generators, I know that it creates factories by default, how can I tell Rails where to put them?

+4
source share
1 answer

factory_girl_rails configures application generators with a specs / factory loop. Cm

https://github.com/thoughtbot/factory_girl_rails/blob/master/lib/factory_girl_rails/railtie.rb#L11

You can override this in the initializer:

 YourAppName::Application.config.app_generators do |g| g.fixture_replacement :factory_girl, :dir => 'factories' end 
+1
source

Source: https://habr.com/ru/post/1388768/


All Articles