Hi I have a field called "cost": <%= f.text_field :cost, :size=>2, :maxlength=>4 %>
I want to check that user enter numeral value and this value is integer In post.rb (model): def cost_validate_int errors.add_to_base("Error message") unless cost.is_a?(Fixnum) puts "### #{cost}: "+cost.class.to_s end When I enter in field 100 I get: ### 100: Fixnum when I enter 10.1: ### 10: Fixnum when I enter 'asdf': ### 0: Fixnum I completely can't understand what happen. In migration: t.integer :cost I think ActiveRectord converts value to Fixnum because in migration this field signed as integer Can I in some way check cost value in model (value should be numeral and integer)? Thanks in advance! -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.