Comparing form enrty to a databse record

I have one field on a from where a number will be entered called
“amount”. I need to compare this to an existing field in the database
also named “amount” to make sure it is a higher number.

I also have to find this specific record by comparing it’s “post_id”
field with @session[:post].id Any help here would be greatly
appreciated.