Topic: Wrong number of arguments for to_s

I'm using the date helper to_s(:long), but its causing a functional test to fail saying that to_s has an incorrect number of arguments. I tried requiring active_support and actionview (which I believe is unnecessary, but I figured hey, why not) and nothing works. What am I doing wrong? It works when I view the page, just not in testing

Rails, Javascript, Actionscript and More.

Re: Wrong number of arguments for to_s

Good idea to post your code that is causing the problem.  Might help.



Re: Wrong number of arguments for to_s

I also ran into this problem where I was formatting the created_at field of my model:

  Created At: <%= h(model.created_at.to_s(:long)) %>

I found that the testing fixtures do not populate the created_at fields of your tables and I had to update my fixture to do so:

  created_at: <%= %>

Does anyone know why the created at fields are not automatically populated for your fixtures for functional testing?

Re: Wrong number of arguments for to_s

When you define fixtures they have only the data you input into the fixtures and nothing more. You need to manually set every field you want set. This is useful for when you want to test something like:

created_at: <%= ( -5).to_s :db %>

For testing something that was created 5 days ago.