Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>First off, the params that you pasted include values for the profile's city, country and gender. If this is accurate, then validation <em>should</em> pass, because the <code>Profile</code> model validates the presence of these 3 fields -- and they are present.</p> <p>I also note that you're doing <code>resource.build_profile</code> in the view, which should build up a default profile belonging to the user. If any values are being assigned in the profile during instantiation, this would cause them to make their way into the form, and ultimately into the params hash.</p> <p>So my guess is that you're populating the fields somewhere along the line, perhaps in the <code>User</code> or <code>Profile</code> models. You should check those again, particularly during initialization of a new profile.</p> <p>That's all I can guess at from the data you've given. If you still can't find the issue, you could try committing it (or a separate app which reproduces the issue, if you're uncomfortable sharing your real app) to GitHub so that we can analyze the issue more directly.</p> <p>EDIT: just noticed, in your bounty you wrote:</p> <blockquote> <p>anyone can provide a working example [of] nested resources and validations</p> </blockquote> <p>So, see <a href="https://github.com/sinisterchipmunk/rubytastic" rel="nofollow">https://github.com/sinisterchipmunk/rubytastic</a> for a simple example of user validation with nested attributes for a Profile, modeled after your question. It validates <code>User#email</code>, <code>Profile#city</code>, <code>Profile#country</code> and <code>Profile#gender</code>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload