24
29

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

railsでリッチテキスト(wysiwyg)エディタを導入してみる

Posted at

tinymce_rails(https://github.com/spohlenz/tinymce-rails) を入れようとして苦闘したけど諦めた。rails4に対応してない?

代わりにckeditorを試してみたらすんなり入った。

先にimagemagick入れておいて、

brew install imagemagick
gem 'ckeditor'
gem 'carrierwave'
gem 'mini_magick'
bundle install
rails generate ckeditor:install --orm=active_record --backend=carrierwave

simple-form使っているのでviewにはこんな感じで記述

<%= f.input :description, :as => :ckeditor, :input_html => { :ckeditor => {:toolbar => 'Full'} } %>

画像アップロード機能付きでリッチテキストエディタ導入できた。

ただ、herokuにデプロイしてみると、assets以下のファイルのURLがプリコンパイルされたダイジェスト付きのものを参照していなくて動作せず、以下を参考にダイジェスト無しのものを作成してdeployしてみた。

動いた。

24
29
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
24
29

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?