jeudi 28 janvier 2016

Rails Test Case Use one fixture value in another Fixture

I have two fixtures files.

country.yml

KENYA:
  country_code: kenya
  short_code: ke

post.yml

my_post:
  content: "Lorem Ipsum"
  location: kenya

I am trying to use the KENYA.country_code in my_post.location. If I use

location: KENYA.country_code

It will save it as a string i.e location = "KENYA.country_code".If I use use it inside ruby tags (<% %>), it will raise an error "so such constant exist".

Aucun commentaire:

Enregistrer un commentaire