Debug the code directly using debugger, binding or pry.

try this (assuming thing is your variable)

thing.save

You should see a message "false" telling you that the object wasn't saved

then type

thing.errors

and you should see what the validation errors are
-Jason




On Sep 30, 2014, at 9:16 PM, Jan Yo <li...@ruby-forum.com> wrote:

> I do  a create on an Active Record model in a controller and it's doing
> something strange.  It's primary key (id) is nil, created/updated are
> nil as well.
> 
> A few of the columns/attributes are nil as well.  The model instance
> gets created but the id is nil.
> 
> Rspec fails for the model because its id is nil (because it's being
> passed to other models)
> 
> Any ideas?

-- 
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+unsubscr...@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/1A5D5920-B83A-4D96-A150-9727491AA09F%40datatravels.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to