Question: I setup Devise on `User` model with its default options.

I also have a `Company` model that needs to add data added whenever a user registers. A company owner setups a `User` to login with and a `Company` profile, both in the same form.

I setup `Company` model with `has_many :users` and `User` with `has_one :company`, but I keep getting `Can't mass-assign protected` when submitting the form. I followed [Profile model for Devise users?](https://stackoverflow.com/questions/4307743/profile-model-for-devise-users) and others from Stackoverflow, but no luck.

How can I setup the `User` and `Company` model to add the necessary data whenever a user registers? User data to `User` and company data to `Company`.

Answer: 
Note that array indexes start with **zero**, try to decrement the value retrieved from the int array.

```
for (int i=0; i<intArray.length; i++) {
        if(intArray[i] != 0) {
            System.out.println( stringArray[ intArray[i]-1 ] );
        }
}

```
your loop is fine, but you must ensure that the int array has int values in the [0..stringArray) range. That is, if your stringArray has size 5, the valid random numbers are in the closed interval [0,1,2,3,4]