Skip to content

#create failing silently when a embedded_attribute validation fails #1086

Closed
@wemcdonald

Description

@wemcdonald

create fails silently if an embedded has_one object has a validation error.

class Question < ActiveRecord::Base
  has_one :answer
  accepts_nested_attributes_for :answer
end
class Answer < ActiveRecord::Base
  belongs_to :question
  validates :text, :inclusion => %w{42 no}
end

POST to /activeadmin/questions:

Processing by Activeadmin::QuestionsController#create as HTML
Parameters: {"question"=>{"answer_attributes"=>{"text"=>"yes"}}, "commit"=>"Create Question"}

What I see

AA redirects to ActiveAdmin::QuestionsController#new and logs no errors

What I expect to see

A validation error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions