导轨4与CKeditor [英] rails 4 with CKeditor

查看:115
本文介绍了导轨4与CKeditor的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法获得galetahub ckeditor宝石与Rails 4一起工作。我在网上搜索任何问题,但找不到任何。

I cannot get the galetahub ckeditor gem to work with Rails 4 for me. I searched for any problems online but cannot find any. I'm following the instructions exactly.


  • 我在我的Gemfile中加入gemckeditor

  • 我包括gemcarrierwave和gemmini_magick

  • 我运行 rails generate ckeditor:install --orm = active_record --backend = carrierwave

  • 在应用程序内部运行 rake db:migrate
  • code> config.autoload_paths + =%W(#{config.root} / app / models / ckeditor)
  • mount Ckeditor :: Engine => '/ ckeditor'

  • 我使用SimpleForm,所以我粘贴以下ERB <%= f.input:description,as ::ckeditor%>

  • I include gem "ckeditor" in my Gemfile
  • I include gem "carrierwave" and gem "mini_magick"
  • I run rails generate ckeditor:install --orm=active_record --backend=carrierwave
  • I run rake db:migrate
  • Inside application.rb I include config.autoload_paths += %W(#{config.root}/app/models/ckeditor)
  • Inside routes.rb I have mount Ckeditor::Engine => '/ckeditor'
  • I'm using SimpleForm so I paste the following ERB <%= f.input :description, as: :ckeditor %> in my view.

我认为就是这样。但我的文本区域不会由于某种原因转换为CKeditor区域。

And I think that's it. But my text area does not convert to a CKeditor area for some reason.

推荐答案

问题是表单助手

form.cktext_area

或在您的情况下

f.input :description, as: :ckeditor

它不会生成它应该生成的东西,你不必手动加载编辑器,你唯一需要做的是将类'ckeditor'添加到你的textarea,它会自动加载,如下所示:

it's not generating what it supposed to generate, and you don't have to load the editor manually, the only thing you need to do is to is to add the class 'ckeditor' to your textarea and it will load automatically, like this:

f.cktext_area :body, :class => 'ckeditor'

这篇关于导轨4与CKeditor的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆