Saving rich text to the database

I've started trying to use the wysihat rich text editor from 37- signals and everything is going well except that I get an error when trying to save the text from the enhanced field to the database. This is from my log:

Processing InstructionsController#new (for 127.0.0.1 at 2009-02-25 06:04:57) [POST]   Session ID: BAh7CCIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNo %0ASGFzaHsABjoKQHVzZWR7ADoMY3NyZl9pZCIlMjNkODY3MzA1YTVkMmQ2MTgw %0AZDdhZTA1Y2I1OTZlZmI6CXVzZXJpCQ%3D%3D-- f732f8aee1da43652706372f3d32f66ce203b19b   Parameters: {"commit"=>"Create", "instruction"=> {"description"=>"first\nsecond\nthird"}, "authenticity_token"=>"88c467dd4b6f308ac40ebd2025a5193874f5ac0f", "action"=>"new", "controller"=>"instructions"}   e[4;36;1mUser Columns (0.004000)e[0m e[0;1mSHOW FIELDS FROM `users`e[0m   e[4;35;1mUser Load (0.000000)e[0m e[0mSELECT * FROM `users` WHERE (`users`.`id` = 4) e[0m   e[4;36;1mInstruction Columns (0.003000)e[0m e[0;1mSHOW FIELDS FROM `instructions`e[0m   e[4;35;1mSQL (0.000000)e[0m e[0mBEGINe[0m   e[4;36;1mInstruction Create (0.000000)e[0m e[0;1mINSERT INTO `instructions` (`start_day`, `title`, `description`, `appointment_id`, `frequency`) VALUES(NULL, NULL, 'first\nsecond\nthird', NULL, NULL)e [0m   e[4;35;1mSQL (0.063000)e[0m e[0mCOMMITe[0m

NoMethodError (You have a nil object when you didn't expect it! The error occurred while evaluating nil.call):

How do I go about saving text from this field to the database? Does it save it as html markup?

Couple of questions: first, what happens if you copy and paste the insert SQL into your database and run it (i.e., are you sure the SQL works on your db)? Second, what is in your log after the NoMethodError message?

I've been trying to figure this out and I don't think its an issue with the database. When the form is submitted, its contents are blank everytime, so it is not submitting correctly. I have made a pastie with my console output, ignore the template error, I am just trying to get it to submit the contents of the text area: http://pastie.org/400591.

Has anyone been able to use the wysihat library and successfully save to the database?

Okay I figured it out. I emailed Josh, the author of the library and this was his response:

If you using the 0.1 release it should automatically sync the description textarea and the rich text area.

In on the latest version, I disabled this feature by default because it was slowing alot of browsers down. So you can manually flush the content out with "editor.save();". So you could do onclick="editor.save();" or something like that.

So I also had to make editor a global variable and then I included editor.save() in :before with submit_to_remote