Sha256: 7181e24cdf525414ecc4fe618853033fd44323b9d7bb96250bc0b1202faf85a6

Contents?: true

Size: 363 Bytes

Versions: 17

Compression:

Stored size: 363 Bytes

Contents

view :editor do |args|
  form.text_field :content, :class=>'card-content'
end

event :validate_number, :after=>:approve do
  errors.add :content, "'#{content}' is not numeric" unless valid_number?( content )
end

def valid_number?( string )
  valid = true
  begin
    Kernel.Float( string )
  rescue ArgumentError, TypeError
    valid = false
  end
  valid
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
wagn-1.14.9 mod/05_standard/set/type/number.rb
wagn-1.14.8 mod/05_standard/set/type/number.rb
wagn-1.14.7 mod/05_standard/set/type/number.rb
wagn-1.14.6 mod/05_standard/set/type/number.rb
wagn-1.14.5 mod/05_standard/set/type/number.rb
wagn-1.14.4 mod/05_standard/set/type/number.rb
wagn-1.14.3 mod/05_standard/set/type/number.rb
wagn-1.14.2 mod/05_standard/set/type/number.rb
wagn-1.14.1 mod/05_standard/set/type/number.rb
wagn-1.14.0 mod/05_standard/set/type/number.rb
wagn-1.14.0.pre3 mod/05_standard/set/type/number.rb
wagn-1.14.0.pre2 mod/05_standard/set/type/number.rb
wagn-1.14.0.pre1 mod/05_standard/set/type/number.rb
wagn-1.13.0 mod/standard/set/type/number.rb
wagn-1.13.0.pre2 mods/standard/sets/type/number.rb
wagn-1.13.0.pre1 mods/standard/sets/type/number.rb
wagn-1.13.0.pre mods/standard/sets/type/number.rb