Ruby Validation failed on .create

I am attempting to use a .create method but constantly getting back the error:

Validation failed: Account can't be blank

This is the code I am running to produce the error:

What could cause .create! to produce that error when it is apparent that :account is not blank?


Here is some more info around my validations:

*It's worth noting that I the sample code in my initial post is not the complete script, but simple the code I am experiencing the error with. I define several other attributes inside that script but didn't want to put too much noise in this post.


Your problem is that you are validates_presence_of on the account_id but you are passing in the account. The error message says Account because when humanizing the field name, it drops the id.

You may want to try create with:

              :account_id =>,
              :date => date

Need Your Help

How do you reference HTML/ASP elements with C# objects?

c# html5

I'm new to ASP.NET and C#, I've primarily worked with Java. I want to dynamically add nodes to a tree view. I've followed a few tutorials but whenever I implement them they do not appear to work. I...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.