Re: [Rails] rails form submission raising ActiveRecord::RecordNotUnique

13 views
Skip to first unread message

Colin Law

unread,
Dec 28, 2015, 1:15:34 PM12/28/15
to Ruby on Rails: Talk
On 28 December 2015 at 14:32, fugee ohu <fuge...@gmail.com> wrote:
> my _form.html.erb was rendered by new.html.erb; from my form:
> <%= form_for(@profile) do |f| %>
> from firefox->tools->web developer->page source
>
> <form class="new_profile" id="new_profile_0" action="/profiles"
> accept-charset="UTF-8" method="post"><input name="utf8" type="hidden"
> value="&#x2713;" /><input type="hidden" name="authenticity_token"
> value="COqGl7mSxKUqj0cTSqLfPJ4Ov40+Zv8iXhhdteiPDrNL6aD9OI+o0LxKAZ+rCy/zrDO0ROB1+yA3bEaZ8IHfQw=="
> />
>
> and then when submitted raises ActiveRecord::RecordNotUnique in
> ProfilesController#create
> the create action:
> def create
> @profile = Profile.new(profile_params)
> ...
> so what's wrong

As I am sure you saw when you googled for the error that this means
that one of your uniqueness constraints on the profile is being saved.

Colin
Reply all
Reply to author
Forward
0 new messages