Arrays in test fixtures

I have a model called role which has many rights. However, I’m having
trouble expressing this in my text fixture:

administrators:
id: 1
name: Administrators
rights: How do I add an item to the rights array here?

eggie5 wrote:

I have a model called role which has many rights. However, I’m having
trouble expressing this in my text fixture:

administrators:
id: 1
name: Administrators
rights: How do I add an item to the rights array here?

You need to create the rights in a fixture on it’s own and then set the
administrator_id in that fixture. Just like you would if you were
creating the rows in the database by hand.


Cheers,

  • Jacob A.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs