On Thursday, February 8, 2018 at 12:23:43 PM UTC-5, Walter Lee Davis wrote:
> That validation was probably on the person, not the picture, unless you
> added validates_associated to the Person class.
> Look at this:
> and this:
> The rest is scaffolded, there's nothing mysterious here.
> Clone this to your machine, run it in rails server.
> Go to localhost:3000/pictures and add some pictures (just file names).
> Go to localhost:3000/people, and add some people.
> See how you can choose pictures for each person? See how the association
> is saved and updated? Watch in the console as the record is saved or
> updated from the web.
> > I created an update action in the persons controller Valitadation was
> failing with :name can't be blank so I assumed @person.save was trying to
> create a new picture That's why I moved the action from the pictures
> controller to the persons controller and changed the action to
> @person.update instead of @person.save Did you already understand that?
I'll do that today thanks In the meanwhile, the validtion's in picture.rb
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
To post to this group, send email to firstname.lastname@example.org.
To view this discussion on the web visit
For more options, visit https://groups.google.com/d/optout.