Ruby on Rails
Thursday, February 1, 2018
On 1 February 2018 at 13:49, fugee ohu <fugee279@gmail.com> wrote:
On Thursday, February 1, 2018 at 3:51:37 AM UTC-5, Colin Law wrote:On 1 February 2018 at 07:30, fugee ohu <fuge...@gmail.com> wrote:I'm having find_or_create_by roll back on me in the console directly from the model I'm not providing an id, the mysql id column is autoincrementModel.find_or_create_by(person_id: 1, picture_id:37) What happens if you try and create a record (where there is not already a matching record) with only those fields?ColinSame thing It works only if I remove all the belongs_to from Model
Have you got any validations on the model?
Can you show us the model code where it has the associations and validations?
What do you see in the log when you try to do it?
Colin
--
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 rubyonrails-talk+unsubscribe@googlegroups.com .
To post to this group, send email to rubyonrails-talk@googlegroups.com .
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ .aa095ea1-5568-402a-978f- 9c6f794a8eb6%40googlegroups. com
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 rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLtd08aOLPx_WPjKkEbUzY_mjR5cBXZyd-HF6HMhN-qVsg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment