GithubHelp home page GithubHelp logo

Comments (7)

spohlenz avatar spohlenz commented on June 14, 2024

Hmm, I'm not seeing this. Can you upload a test app to GitHub that demonstrates the issue?

from tinymce-rails.

czak avatar czak commented on June 14, 2024

I think I'm having a similar issue, but haven't pinpointed it yet.

The form (and TinyMCE) display properly in the browser.
But fails in the spec.

This is a request spec with Capybara:

  1) Creating an Article saves correctly when filled with valid data
     Failure/Error: visit new_article_path
     ActionView::Template::Error:
       undefined method `tinymce' for #<#<Class:0x007fe23ac17018>:0x007fe23c9b0fe8>
     # ./app/views/articles/_form.html.erb:19:in `_app_views_articles__form_html_erb__1243779275900824040_70304831220100'
     # ./app/views/articles/new.html.erb:1:in `_app_views_articles_new_html_erb___3793578565898622305_70304795223600'
     # ./app/controllers/articles_controller.rb:21:in `new'
     # ./spec/requests/create_article_spec.rb:6:in `block (2 levels) in <top (required)>'

The bug just appeared after this sigle change in the project:

diff --git a/Gemfile.lock b/Gemfile.lock
index f660606..5dd9651 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -23,12 +23,12 @@ GEM
       rack-cache (~> 1.1)
       rack-test (~> 0.6.1)
       sprockets (~> 2.1.2)
-    activeadmin (0.4.3)
+    activeadmin (0.4.4)
       bourbon (>= 1.0.0)
       devise (>= 1.1.2)
       fastercsv
-      formtastic (>= 2.0.0)
-      inherited_resources (> 0)
+      formtastic (~> 2.1.1)
+      inherited_resources (>= 1.3.1)
       jquery-rails (>= 1.0.0)
       kaminari (>= 0.13.0)
       meta_search (>= 0.9.2)
@@ -59,7 +59,7 @@ GEM
     autotest-growl (0.2.16)
     backports (2.3.0)
     bcrypt-ruby (3.0.1)
-    bourbon (1.4.0)
+    bourbon (2.1.0)
       sass (>= 3.1)
     builder (3.0.0)
     capistrano (2.11.2)
@@ -131,7 +131,7 @@ GEM
     jquery-rails (2.0.2)
       railties (>= 3.2.0, < 5.0)
       thor (~> 0.14)
-    json (1.6.6)
+    json (1.7.3)
     kaminari (0.13.0)
       actionpack (>= 3.0.0)
       activesupport (>= 3.0.0)
@@ -215,7 +215,7 @@ GEM
       rspec (~> 2.0)
     ruby-graphviz (1.0.5)
     rubyzip (0.9.6.1)
-    sass (3.1.16)
+    sass (3.1.18)
     sass-rails (3.2.4)
       railties (~> 3.2.0)
       sass (>= 3.1.10)
@@ -237,7 +237,7 @@ GEM
       sinatra (~> 1.3.0)
       tilt (~> 1.3)
     spork (0.9.0)
-    sprockets (2.1.2)
+    sprockets (2.1.3)
       hike (~> 1.2)
       rack (~> 1.0)
       tilt (~> 1.1, != 1.3.0)

Could any of these updates have triggered a change?

from tinymce-rails.

spohlenz avatar spohlenz commented on June 14, 2024

@czak I wouldn't have thought any of those updates would affect tinymce-rails. Would you perhaps be able to trace the issue by starting with a fresh app?

from tinymce-rails.

czak avatar czak commented on June 14, 2024

Ok sorry my bad, the bug appeared after another (also seemingly irrelevant) commit.
I'm monkeypatching ActiveAdmin from an initializer.
This is enough to make the tinymce testing bug appear:

config/initializers/active_admin_monkeypatch.rb

module ActiveAdmin
  module Devise
  end
end

I'll try to whip up a sample app when I have some time.

from tinymce-rails.

czak avatar czak commented on June 14, 2024

Here you go: https://github.com/czak/tinymce-rails-bug-app

  • commit 3cc25a7d breaks the spec
  • obviously this is a convoluted example and I deserve to be punished for monkeypatching
  • but still, this seems weird and maybe it will help in some way

from tinymce-rails.

spohlenz avatar spohlenz commented on June 14, 2024

I'm still looking into this but you can take ActiveAdmin out of the equation at least, which leaves Devise as a possible source of the issue. The following in your initializer is enough to trigger the issue:

::Devise::DeviseController

from tinymce-rails.

spohlenz avatar spohlenz commented on June 14, 2024

Can you confirm that this commit fixes the issue for you?

The issue turned out to be exposed simply by referencing ApplicationController within the initializer (which is what Devise::DeviseController was loading). At this point, ApplicationController creates its own module for its helpers, however tinymce-rails has not yet been initialized. When the tinymce-rails initializers are finally run, they were adding the helpers to ActionController::Base but these helpers were not propagating down to ApplicationController's helpers.

from tinymce-rails.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.