attrtastic icon indicating copy to clipboard operation
attrtastic copied to clipboard

Rails 3.1 , mongoid 2.3.1, float-field, -> wrong argument type nil (expected Fixnum)

Open dryaf opened this issue 14 years ago • 2 comments

class Post
  include Mongoid::Document
  include Mongoid::Timestamps

  field :name, :type => String
  field :age, :type => Integer
  field :cool, :type => Float

end

results in

Showing /home/sallas/Aptana Studio 3 Workspace/viterma/app/views/posts/show.html.haml where line #13 raised:

wrong argument type nil (expected Fixnum)
Extracted source (around line #13):

10:       =p.attributes  do
11:         = p.attribute  :name
12:         = p.attribute  :age
13:         = p.attribute  :cool
14:     

Framework-Trace: actionpack (3.1.0) lib/action_view/helpers/number_helper.rb:281:in round' actionpack (3.1.0) lib/action_view/helpers/number_helper.rb:281:innumber_with_precision' attrtastic (0.4.2) lib/attrtastic/semantic_attributes_builder.rb:390:in format_attribute_value' attrtastic (0.4.2) lib/attrtastic/semantic_attributes_builder.rb:314:inattribute' haml (3.1.3) lib/haml/helpers/action_view_mods.rb:93:in block in capture_with_haml' haml (3.1.3) lib/haml/helpers.rb:345:incall' haml (3.1.3) lib/haml/helpers.rb:345:in block in capture_haml' haml (3.1.3) lib/haml/helpers.rb:569:inwith_haml_buffer' haml (3.1.3) lib/haml/helpers.rb:341:in capture_haml' haml (3.1.3) lib/haml/helpers/xss_mods.rb:61:incapture_haml_with_haml_xss' haml (3.1.3) lib/haml/helpers/action_view_mods.rb:93:in capture_with_haml' attrtastic (0.4.2) lib/attrtastic/semantic_attributes_builder.rb:355:inattributes_for' attrtastic (0.4.2) lib/attrtastic/semantic_attributes_builder.rb:196:in attributes' haml (3.1.3) lib/haml/helpers/action_view_mods.rb:93:inblock in capture_with_haml' haml (3.1.3) lib/haml/helpers.rb:345:in call' haml (3.1.3) lib/haml/helpers.rb:345:inblock in capture_haml' haml (3.1.3) lib/haml/helpers.rb:569:in with_haml_buffer' haml (3.1.3) lib/haml/helpers.rb:341:incapture_haml' haml (3.1.3) lib/haml/helpers/xss_mods.rb:61:in capture_haml_with_haml_xss' haml (3.1.3) lib/haml/helpers/action_view_mods.rb:93:incapture_with_haml' attrtastic (0.4.2) lib/attrtastic/semantic_attributes_helper.rb:51:in `semantic_attributes_for'

dryaf avatar Oct 11 '11 22:10 dryaf

This is not an attrtastic-Bug. It is a rails bug

probably its good to leave this bug open tills it is fixed so people can find a solution quickly

fix is here: https://github.com/rails/rails/issues/2802

dryaf avatar Oct 11 '11 22:10 dryaf

Ok, no problem leaving this as a way to find correct solution for problem.

MBO avatar Oct 13 '11 13:10 MBO