Tuesday, 15 February 2011

ruby on rails - Factory girl conflict between field names with association -


For reasons of heritage, I have a model in the rail with two areas: city and City_id .

city is a string with the name of the city city_id is a reference to a city object.

How do I declare my factory factory group?

I would like to populate the cities and cities of the city:

factory: find out street "street x" city # city city factory city city "mycity" # heritage Use the city's end

But how is the difference between these two city zones? According to

, you can only use built-in collaboration while following general conventions. So in this case you will need to use a clear call for the association method.

In the example given below, : replace_this is replaced by the code in your model: related_to :

  factory : Address Street "Street X" Union: replacement_The factory: city # city city factory uses city "Mycity" # Legacy City End  

No comments:

Post a Comment