Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't iterate from Float #19

Closed
jerodsanto opened this issue Mar 27, 2011 · 6 comments
Closed

can't iterate from Float #19

jerodsanto opened this issue Mar 27, 2011 · 6 comments

Comments

@jerodsanto
Copy link

I have a model with a float attribute and when I turn csv on for its form I get the following type error:

can't iterate from Float

Removing this field from the form makes everything work as expected.

I'm on Rails 3.0.5 using ActiveRecord, form_for and csv gem 3.0.0.beta.7.

@bcardarella
Copy link
Contributor

Can you provide some example code? Which validations are on the attribute?

@bcardarella
Copy link
Contributor

Also, is this a Rails error or a javascript error?

If it is Javascript take note that there is now a new javscript file starting with 3.0.0.beta.7: rails.validations.js

@jerodsanto
Copy link
Author

It's a Rails error. The field is called duration and the validation on it is:

validates_inclusion_of :duration, :in => 0.25..10, :message => "must be between 0.25 and 10.0 hours"

I recently upgraded this app to Rails 3 and haven't had a chance to switch to the new validates API. If you think that will help here I will give it a try.

The form is pretty vanilla. Here is the related label and field:

<%= form.label :duration, "Duration (hours)" %>
<%= form.text_field :duration, :autofocus => true %>

@bcardarella
Copy link
Contributor

Ok, I see it. I should have this fixed soon and push a new beta out later tonight. Thanks for the bug report.

@bcardarella
Copy link
Contributor

Fixed in 209a250

@jerodsanto
Copy link
Author

Confirmed, it works! Thanks for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants