title: Rails5｜Uncaught TypeError: $(...).froalaEditor is not a function
body: <p>I'm using rails5.0.6 and trying to add Froala editor to my project.</p>
  
  <p>In development it works fine,but in production Froala does not work and result is</p>
  
  <blockquote>
    <p>new:107 Uncaught TypeError: $(...).froalaEditor is not a function</p>
  </blockquote>
  
  <p>To solve this problem,　I did</p>
  
  <ul>
  <li>rails assets:precompile rails_env=production</li>
  <li>In production.rb,rewrite config.assets.compile = true</li>
  </ul>
  
  <p>but I do not solve.</p>
  
  <p>In my assets/javascripts/application.js:</p>
  
  <pre><code>//= require jquery
  //= require jquery_ujs
  //= require turbolinks
  //= require main/bootstrap.min
  //= require froala_editor.min.js
  //= require plugins/colors.min
  //= require plugins/font_size.min
  //= require plugins/char_counter.min
  //= require languages/ja
  //= require_tree ./main
  </code></pre>
  
  <p>In my articles/new 107:</p>
  
  <pre><code>&lt;script&gt;
    $(function() {
  $('#wysiwyg').froalaEditor({     
    language: 'ja',      
    toolbarButtons: ['bold','strikeThrough','fontSize']
  });
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>In my config/production.rb:</p>
  
  <pre><code>Rails.application.configure do
  config/application.rb.
  
    config.cache_classes = true
  
    config.eager_load = true
  
  config.consider_all_requests_local       = false
    config.action_controller.perform_caching = true
  
  config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
  
    config.assets.js_compressor = :uglifier
  
    config.assets.compile = true
  
    config.log_level = :debug
  
    config.log_tags = [ :request_id ]
  
    config.action_mailer.perform_caching = false
  
  
    if ENV["RAILS_LOG_TO_STDOUT"].present?
      logger           = ActiveSupport::Logger.new(STDOUT)
      logger.formatter = config.log_formatter
      config.logger = ActiveSupport::TaggedLogging.new(logger)
    end
  
    config.active_record.dump_schema_after_migration = false
  end
  </code></pre>