I just solved an issue that I couldn’t find an answer for on the web, so I thought I’d just put it out there so that maybe it could help someone else. I am creating a simple CMS tool for one of my clients and always like to use the FCKEditor for CMS tools. I hadn’t built such a thing in Rails before, nor had I used ActiveScaffold before today. But Rails + ActiveScaffold + FCKEditor seemed like the perfect combination. And it is, once you get it working. Here’s what I had to do to make this work for a table called content_items and a field called content.
After installing the FCKEditor and ActiveScaffold plugins, I created, for the content column, a form column override file in my views/content_items directory called _content_form_column.rhtml. After some trial and error, I landed at this solution:
<%=column.name.to_s.titleize %>: <%= fckeditor_textarea( :record, column.name, :toolbarSet => 'Simple', :width => '100%', :height => '400px') %> <input name="commit" type="submit" value="Save" class="submit" onClick="var oEditor = FCKeditorAPI.GetInstance('record_<%=@record.id%>_<%=column.name%>_editor'); document.getElementById('record_<%=@record.id%>_<%=column.name%>_editor').value = oEditor.GetXHTML();" />