I’m just learning rails right now and for simple CRUD operations I’m using scaffold to generate some code. I’m using Rails 1.2.6.
I’ve changed some of the fields to use an autocomplete feature and validation using validate_presence_of is not working on these fields. The problem is that this fields are related to stuff inside a different model, like:
I have two tables, one called artist and the other called album. Album has a foreign key to Artist. So in the _form.rhtml for the album i have a field with autocompletion for the name of the artist. In the album controller I make a search for the artist with the received name and associate it to the newly created instante of Album. But if the user sends the form with the artist_name empty, I don’t know how to use the validation helpers…
This isn’t working for select fields nether. Putting it simple, it just works for ordinary text fields.
Thank you very much!