I am attempting to store a SHA-2 256 bit checksum inside a column:

create_table :checksums do |t|
  t.binary :value, :null => false, :limit => 32
end

I am storing within the value like so:

c = Checksum.new
big_num = Digest::SHA2.new.update("some string to be checksum'd").hexdigest.to_i(16)
c.value = big_num

Around the assignment of large_num to c.value I recieve:

NoMethodError: undefined method `gsub' for #<Bignum:0x00000001ea48f8>

Anybody understand what I am doing wrong?

If you are likely to be storing your SHA2 inside a binary column then you definitely most likely would like to make use of the [cde] method to obtain the raw SHA2 bytes:

digest

Your SHA2 is really a 256 bit value (32 bytes) which will not easily fit in a Fixnum (which utilizes under 32 or 64 bits because of internal bookkeeping bits), this is exactly why you finish track of a Bignum whenever you call big_num = Digest::SHA2.new.update("some string to be checksum'd").digest . Binary posts are actually just sequences of bytes (i.e. binary strings) and area of the encoding mechanism is most likely using [cde] to obtain the bytes in to the format the database needs. You are setting a Bignum to something which needs to determine a String which does not work that well.

You might make use of a simple string column (with .hexdigest.to_i(16)) to keep the gsub value rather than a 32 byte binary column.