Consider carefully what precisely you are trying to achieve with this task.
If your goal is to securely transmit user-input data from your page to the server without leaving it vulnerable to interception or decryption, then the most reliable and widely-used method is to implement HTTPS for your communication.
Alternatively, if you're interested in experimenting with AES encryption on your page, you can refer to this question for information on implementing AES encryption on the client side, while Ruby has easy integration with OpenSSL on the server side.