从我在这里找到的内容启发,我想到了使用javascript在隐藏对象
textarea和
CKEditor对象上设置数据的解决方案。视情况而定,两者似乎都不足够。
def fill_in_ckeditor(locator, opts) content = opts.fetch(:with).to_json # convert to a safe javascript string page.execute_script <<-script CKEDITOR.instances['#{locator}'].setData(#{content}); $('textarea##{locator}').text(#{content}); scriptend# Example:fill_in_ckeditor 'email_body', :with => 'This is my message!'


